Return Function?

What does return fucntion(...) mean or do?

image

I recently saw this in a video and because I’ve never seen something like that in a script, I was wondering what it does and what you could do with this.

1 Like

What does return function() do? It returns a function, that’s it. You can load the function in another script, if you use that code in a ModuleScript, using require().

This can be used for modularity. Alternatively, you can return a whole table of functions, or even use metatables with various methods such as __index or __call to modify the behavior on the module.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.