lua-users home
lua-l archive

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

Luiz Henrique de Figueiredo wrote:
> For debugging, the function is active, and there is a way. As the manual says:
>    Then, whenever the C function is called, these upvalues are inserted
>    as the last arguments to the function, after the actual arguments
>    provided in the call. This makes it easy to get the upvalues without
>    knowing how many arguments the function received (recall that
>    functions in Lua can receive any number of arguments): The i-th
>    upvalue is in the stack at index i-(n+1), where n is the number of
>    upvalues.
> So, you can use getlocal or lua_getlocal.
> --lhf

I believe that the manual is referring to getting upvalues passed to a C
routine from lua.  This is not the same problem.  I took a quick look at
the implementation of lua_getlocal.  It calls luaF_getlocalname which
does not handle upvalues.  It looks to me like the names of the upvalues
are not saved, so I guess that retrieving an upvalue by name (as is
needed for debugging) is simply not possible.