lua-users home
lua-l archive

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

>I have been using upvalues as a way to hide functions and variables
>which are shared within a "module" but do not need to be known
>globally.  Unfortunately, it seems that I have no way to examine these
>when debugging.

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

So, you can use getlocal or lua_getlocal.