lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>>>>> "Joseph" == Joseph Manning <manning@cs.ucc.ie> writes:

 Joseph> The alternative is, of course, to use 'os.exit( )' -- but in
 Joseph> the above context, does using 'return' basically achieve the
 Joseph> same effect?

os.exit() doesn't close the Lua state before exiting, whereas returning
from the invoked chunk does.

$ lua53 -e 't = setmetatable({},{__gc=function() print "foo" end})'
foo
$

$ lua53 -e 't = setmetatable({},{__gc=function() print "foo" end}) os.exit(0)'
$

-- 
Andrew.