[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: does the current environment revert automatically?
- From: Mike Pall <mikelu-0712@...>
- Date: Wed, 19 Dec 2007 21:29:02 +0100
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)).