lua-users home
lua-l archive

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

I finally have time to move to w5. Here's a summary of the changes that I'm
still rolling in...

* lauxlib.c: Teach luaL_argerror to deal with errors from lua_getstack
caused by an absence of stack frames. These can occur if code invokes a
type-test on values that are on a Lua stack outside of a Lua function scope.
For example, native code might hold a reference to a Lua table and need to
look something up in it. That code might want to invoke an error if the
value wasn't actually a table. This matters more when the exception logic is
patched to work with native exceptions. This isn't an issue if everything
gets wrapped in a cpcall, but that's a relatively painful part of the API to
code to at this point.

We replace the call to lua_getstack with:

  if(!lua_getstack(L, 0, &ar)) {
      return luaL_error(L, "bad value at stack index #%d (%s)",
                            narg, extramsg);

* Add linedefinedend to lua_Debug data structure and lineDefinedEnd to Proto
data structure. Maintain them in conjunction with linedefined and
lineDefined. (I don't know whether the differences in capitalization are
intentional in the Lua sources.) This affects:

    ldebug.c, lfunc.c, lobject.h, lparser.c, lua.h

* Set the status value in a Lua state before calling the panic function.

In ldo.c, we add the following line to luaD_throw just before it calls

    L->status = errcode;

This allows panic functions to see the error code and take appropriate
action such as translating into some other exception system. As with the
lauxlib.c patch above, a nicer approach would be figuring out how to get the
effect of lua_cpcall without the convoluted code required to use it.

* lgc.c:


    if (!L->allowhook) return;

To the beginning of luaC_step to avoid recursive processing during GC
metamethod handling.

* OP_SELF __methods metamethod patch. This allows the creation of a separate
hook point for : dispatching indepdendent of . Lookup.

    ltm.c, ltm.h, lvm.c