lua-users home
lua-l archive

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


Prior to 5.4, luaL_checkversion checks that there isn't more than one
copy of the interpreter code involved, that is to say that a static
variable will have the same address regardless of what module it got
called from.

5.4 abandons this check; apparently it was believed to be unnecessary?

But I think it _is_ necessary and that you can probably (I haven't
actually done the test case yet) get unexpected errors from having
multiple copies of the interpreter. Specifically, ll_loadlib relies on
registry[&CLIBS], where &CLIBS is a lightuserdata with the address of a
static var. If there are multiple copies of the interpreter and you call
require or loadlib from one other than the one that created the state,
it'll end up calling lua_getfield on a nil value, which will throw an
error.

Am I wrong?

-- 
Andrew.