lua-users home
lua-l archive

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

BTW, although the confusion is cleared up, accessing a table is still
needlessly slow. So I'm gonna stick with my solution and stick with my
request to add it for 4.1.

-----Original Message-----
From: Luiz Henrique de Figueiredo [] 
Sent: Wednesday, October 03, 2001 5:51 PM
To: Multiple recipients of list
Subject: RE: Private data

>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