[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Possible bug?
- From: David Morris-Oliveros <david@...>
- Date: Thu, 13 Oct 2005 15:28:49 +1000
I've looked over it quite closely. I still think it's a bug in my code,
but I came across this:
[
L->top - L->base = 2
L->ci->top - L->base = 20
]
// the function been called has a deliberate error
int result = lua_resume( L, 0 );
[
L->top - L->base = 5
L->ci->top - L->base = 2
result = LUA_ERRRUN
]
Here is the function that I'm calling:
RUN = function() Cameras.dd(0) end
Where Cameras is a normal lua table, but dd doesn't exist.
Will still keep looking...
Rici Lake wrote:
On 12-Oct-05, at 10:44 PM, David Morris-Oliveros wrote:
It asserts on line 4 of the code below. Now my question is, is it
supposed to be L->ci->top or just L->top? Because lua_gettop() is
(L->top - L->base), and like 9 below is very similar to this.
L->ci->top is the end of the allocated stack (allocated in the sense
that you've done lua_checkstack() to make sure that you have that
stack space available; if you don't do that, you have 20 slots.)
L->top is the top of the actual stack.
If L->ci->top < L->top, something evil has happened (this could happen
if you didn't do a lua_checkstack(), but in that case the index would
be >20).
It's not an api error to refer to a stack slot that has been
allocated, even if it is beyond the end of the current stack.
(Although it's highly questionable.) On the other hand, a negative
index greater than the current end is clearly a non-existent stack
slot. That's why those two lines are different.
I wonder if your problem has to do with the fact that there are two
stacks in play when you're doing coroutines. It's pretty easy to use
the wrong one by mistake.
Rici
--
// David Morris-Oliveros
// Camera & Lua Coder
// Team Bondi
------------------------------------------------------------------------
Contact:
Team Bondi Pty Ltd
Level 2, 608 Harris Street
Ultimo, NSW 2007
Australia
Tel: +61 (0)2 8218 1500
Fax: +61 (0)2 8218 1507
Web: http://www.teambondi.com
------------------------------------------------------------------------
This email may contain confidential information. If you are not
the intended recipient, you may not copy or deliver this message to
anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. Opinions, conclusions and other
information in this message that do not relate to the official business
of our firm shall be understood as neither given nor endorsed by it.
------------------------------------------------------------------------