What does return fucntion(...)
mean or do?
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.
What does return fucntion(...)
mean or do?
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.
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.