lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:
> > Note: there's nothing wrong with the Lua source code and there's
> > no other way to fix it other than fixing linkage.
> 
> Maybe we could move that structure (and luaO_nilobject_) into the global
> state?

Apart from (probably) slowing things down, you're just shadowing
a bug then! That's generally considered a regression. I'd rather
have an error thrown. Something like:

static int staticcheck;

LUA_API void lua_checkconsistency(lua_State *L, int vernum)
{
  if (vernum != LUA_VERSION_NUM || G(L)->staticcheck != &staticcheck)
    luaG_runerror("...");
}

This should be called from strategic places, e.g. luaL_openlibs(),
luaL_register() and maybe some more.

--Mike