[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] LuaJIT-2.0.0-beta1
- From: Mike Pall <mikelu-0911@...>
- Date: Sun, 1 Nov 2009 03:09:43 +0100
Timm S. Mueller wrote:
> fmt = luaL_checkinteger(L, -1);
Aiiieeee ... you're using negative stack indexes with the
luaL_check*() functions?
Maybe the Lua manual could be a bit more clear about this point,
but it *does* say this at the start of section 4:
"Because the error message is formatted for arguments (e.g., "bad
argument #1"), you should not use these functions for other stack
values."
For me this implies, that only positive values cause defined
behaviour.
Obviously the standard Lua implementation is somewhat more
lenient: it properly checks the type of the stack object at the
relative position, but it would report a pretty meaningless error
if the check ever failed (like "bad argument #-7").
Currently LJ2 happily misinterprets negative indexes for these
functions. Sooo ... what to do? I guess I'll have to bite the
bullet and support some undefined behavior, too. :-/
Patch will follow shortly.
--Mike