lua-users home
lua-l archive

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

On Wednesday, December 19, 2007 Mike Pall wrote: 

> Doug Currie wrote:
>> - use lua_replace(L, LUA_ENVIRONINDEX) followed by luaL_register()
>> and then, if you are paranoid about leaking your environment, as I am,
>> use lua_pushnil(L); lua_replace(L, LUA_ENVIRONINDEX) to hide it

> Wrong. The environment must be a valid table. You're storing
> random data this way. Turn on assertions for the C API and it'll
> complain in lua_replace at api_check(L, ttistable(L->top - 1)).

Yikes, thanks Mike. That's what I get for not looking at my code
before posting. Instead of lua_pushnil(L) use lua_newtable(L).


Doug Currie
Londonderry, NH, USA