lua-users home
lua-l archive

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


I am attempting to call lua_getstack in an error hook. I have a simple
function that I call, something like this:

function myerror()
    notafunction()
end

The error hook fires as expected, and the message tells me exactly what
I would expect: "attempt to call global `notafunction' (a nil value)".
So far so good. 

But now I want to get info about the function, so I have a while
(lua_getstack(l, level, &ar)) loop. Problem is, even when level is 0,
lua_getstack returns 0. I was wondering whether the line in lua_getstack
  if (L->ci - L->base_ci <= level) status = 0;  /* there is no such
level */
was supposed to have a < instead of <=. But that doesn't appear to be
the case since the subsequent call to lua_getinfo errors out ("value for
`lua_getinfo' is not a function").

Thanks,

Curt