lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm running into a strange error (probably because of my own lame code). I'm running something in lua_resume(), and there's an error in the script (deliberate), and it comes out of the lua_resume with a LUA_ERRRUN code. I print out the error message ( lua_tostring( L, -1 ) ), then pop the message off the stack.

I then print out the stack contents. lua_gettop() returns 4, so I iterate over the stack, and it asserts on the 3rd element.

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.

Now I don't quite know if what I'm saying makes any sense, or if i'm wrong or the code below is wrong - I don't know enough lua internals to make that call.

BTW, i'm using lua 5.1alpha - downloaded on the 06/10/2005 - just last week.

Cheers to all!


1: static TValue *index2adr (lua_State *L, int idx) {
2:   if (idx > 0) {
3:     TValue *o = L->base + (idx - 1);
4:     api_check(L, idx <= L->ci->top - L->base);
5:     if (o >= L->top) return cast(TValue *, &luaO_nilobject);
6:     else return o;
7:   }
8:   else if (idx > LUA_REGISTRYINDEX) {
9:     api_check(L, idx != 0 && -idx <= L->top - L->base);
10:     return L->top + idx;
11:   }
...
}


--
// 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.
------------------------------------------------------------------------