lua-users home
lua-l archive

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


> Perhaps the test should be debug-time, instead, like this one:
> [...]
>         lua_assert(ttisstring(rb) && ttistable(&cl->g));
> [...]
> which has much more potential to segfault if the code has been
> incorrectly generated (or even if setfenv was called with an incorrect
> argument.)

These conditions are checked by `luaG_checkcode' when Lua loads binary
files, so they cannot happen. But it is more difficult to check that
some specific variables are not touched by other instructions during a
loop. (To call setfenv with an incorrect argument is a C error; in C
there are simpler ways to crash a program ;-)

-- Roberto