The difference is that
do
-- something
end
Creates a new scope/block. This can be useful for creating local variables that aren't stored in the main scope.
An example would be using temporary values to calculate something but will never use again. Instead of having to nil these values after they are done being useful you can let the language deal with freeing up memory when the block ends.
(function(...)
--something
end)(args)
Does something similar, but you can pass arguments to your new scope/block. |