lua-users home
lua-l archive

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


I'm dealing with a C application that loads a C module, and I'm not quite clear about how the module is loaded:

-The application creates several OS threads
-In each of those threads, a Lua state runs
-Each of those states may require('foo') (foo.so, written in C)

From my testing it looks like:
-luaopen_foo() is called from each Lua state
-only a single instance of foo is actually loaded, so any global/static variables it has are shared between all Lua states that load it (as opposed to: each state gets its own independent copy of foo with its own memory)

Is this correct? Are there situations where it isn't?

--
Sent from my Game Boy.