[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: does the current environment revert automatically?
- From: Doug Currie <doug.currie@...>
- Date: Wed, 19 Dec 2007 15:44:57 -0500
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).
e
--
Doug Currie
Londonderry, NH, USA