lua-users home
lua-l archive

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


> There may be another reason, but that's the first that comes to mind.
>

For another reason, look into luaopen_io (and then the rest of the library,
I guess). Once the function is in Lua you can alter its environment. This
makes it easy to load a lot of functions and objects with shared state.

http://lua-users.org/lists/lua-l/2005-04/msg00129.html

Also, like the point about the stack, you're spared some cleanup effort,
since you don't have to save and restore the original environment.