lua-users home
lua-l archive

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


>Two people suggesting using the registry??? You guys scare me! :-) If I

I meant the Lua registry, not the Windows registry, as you have discovered.
I'm sorry about the confusion.

Just to be clear, the Lua registry is an ordinary Lua table that is available
for clients to use as they wish. For instance, libraries might store "global"
information there. See ldblib.c for an example.

The registry was introduced in 4.0 because clients (and the core) could no
longer store Lua information in static C variables, because multiple states
were now possible.

>And add
>	void * pprivatedata;
>to the struct lua_State.

If you really want to do this, then 4.1 is ready for it: simply #define a
suitable string for LUA_USERSTATE. See lstate.h.
--lhf