lua-users home
lua-l archive

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


> I note the removal of lua_userinit.
> 
> What is the recommended way of handling additional user initializations?

No recommended way because needs vary and it's hard to cater for all of them.
(In particular, it was impossible to avoid opening the debug library, for
instance.) So, here are a few choices:

1. Edit linit.c.
2. #define luaopen_stdlibs to your own function in the lua_c section of
   luaconf.h. Note that you'll need to declare it as well.
3. Define a luaopen_stdlibs functon in your code, and let the linker get
   your code instead of Lua's.

These instructions work if you use the stock Lua interpreter lua.c. If
you're writing your own or embedding Lua in your application, then just
call the appropriate luaopen_* functions or luaopen_stdlibs if you need
them all. In this case, it's probably easier to just copy linit.c and
edit it and add it to your project, leaving the original linit.c intact.
--lhf