[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua debug info
- From: Andreas Stenius <kaos@...>
- Date: Thu, 15 Dec 2005 20:40:04 +0100
Roberto Ierusalimschy wrote:
Please tell us where are those places so we can correct them.
[...]
llimits.h
lines 44, 46: changed type from int to long, since the comment says it
might hold values that won't fit in 16 bits.
Actually the comment was wrong :) It is safe to use 16-bit ints there.
Oh, ok :)
lobject.c:62
integer const larger than 16 bits makes my compiler complain (only warning,
so it's no big deal) but it makes me wonder if the calculations may get wrong
The only problem is that the test is always false (and the compiler
is right about the warning). But the algorithm is ok.
Good.
Now, back to the bug:
Yes!
I tried the same example on linux, which gave the expected result:
Wich means we need to debug in your machine... Can you help with
the following tests?
Absolutely.
> do
local test = {}
test.__index = test
function test:foo()
return self[1]
end
function test:func( idx )
local a, b, c = 1, 2, { foo = idx }
if idx.foo then return false end
return self:foo() + idx
end
function new_test()
return setmetatable( { 1, 2, 3, 4, 5 }, test )
end
end
-- What happens if you write "test.func( self, idx )" instead of the original "test:func( idx )"?
-- same error: attempt to index local `self' (a number value)
-- also tried to call it with t.func(t,3) instead of t:func(3)
-- What happens if you add one or more parameters to the function?
-- function test:func( idx, a, b, c )
-- if b.foo then return false end
-- gives: attempt to index local `self' (a nil value)
-- unless called with a table as arg b, so: t:func(3,_,t) == false (since t.foo == function)
-- What happens if you add one or more local variables to the function?
-- same error again.
> t=new_test()
> =t:func(3)
0: self
1: self
2: self
3: self
4: self
R2RMon: stdin:11: attempt to index local `self' (a number value)
stack traceback:
stdin:11: in function <stdin:9>
(tail call): ?
[C]: ?
What's next?
Too bad I don't have a debugger for my target so I could single step through the code (c-side) as it executes..
//Andreas