[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Possible bug in getfunc() in lbaselib.c (5.1.1)?
- From: Doug Rogers <rogers@...>
- Date: Fri, 09 Feb 2007 12:50:29 -0500
Roberto Ierusalimschy wrote:
>> I don't know if it will break other things, but this patch works for me
>> to correct the problem noted above:
> I am afraid this patch would disallow the call "getfenv()".
I did not apply the appropriate rigor to my testing; I tested only the
Lua API, not the C API for userdata. In that case getfenv() works for me
(did it not for you?).
I found it hard to follow what getfunc() was trying to do when the
argument is not a function. I know the behavior desired (to place the
function, thread, or userdatum on the stack followed by the table at
index 2).
After tracing through the calls into lua_getinfo(), lua_checkinteger(),
etc., I don't see how the patch (which checks for type number, then
checks for its value) differs from the original, except that it does not
allow nil and string representations of 0.
So I'll leave it to the more informed to determine the best way to fix it.
Doug
--
Innovative Concepts, Inc. www.innocon.com 703-893-2007 x220