lua-users home
lua-l archive

Re: LUA_USERSTATE.. doesn't work

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


On Jan 31, 2002 at 10:54 -0600, jim@mathies.com wrote:
> | SomeDataStructure allthedata;
> | };
> | #define LUA_USERSTATE MyData mydata;
> | ...
> | L.mydata.SetData(id, data);
> | ...
> | Data = L.GetData(id);
> | 
> | Or of course a struct instead of a class for C users. I like the
> | ultimate flexibility the way it is.
> | Curt
> 
> The main problem is the required recompile of the Lua library to use
> LUA_USERSTATE, and the fact that if your compiling more than one
> external library that makes use of LUA_USERSTATE you run into
> problems. I wouldn't consider this very flexible.
MHO: this is in the "bells and whistles" category for add-in modules;
most modules don't need a LUA_USERSTATE. Ones that really do can use
a Lua table lookup instead, at some run-time cost. If this proves to
be a practical problem, then we revisit it, after we have a working
standardized module system.
Premature optimization being the root of all evil, and all...
-- 
Thatcher Ulrich <tu@tulrich.com>
http://tulrich.com

AltStyle によって変換されたページ (->オリジナル) /