[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: For loops and closures
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 29 Apr 2003 14:26:14 -0300
> 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