lua-users home
lua-l archive

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

> > You store the default callback for a new lua_open() in a 
> global/static 
> > variable.  There is no reason why you wouldn't want to do this.
> I think one important reason would be if you're linking 
> together more than one subsystem that uses Lua.  As it is, if 
> they use separate Lua states, they can be completely 
> independent but still share a liblua.dll/.so.  If there are 
> static variables within the Lua library, then the two 
> subsystems can potentially fight over those, and you have a 
> big headache.

I agree with this, now that I think about it.  Passing in a structure is
probably most effective.  The reasonable defaults when no structure is
passed are Lua's current defaults.  Otherwise, a bunch of startup
variables are fully tweakable, including the memory callbacks.

> Also, for the record, I don't have a problem with varargs in 
> lua_open().  But I think it looks gross to most C++ 
> programmers, which might explain the negative reactions.

Also remember that varargs will be a pain for anybody using Lua in a
language other than C.