lua-users home
lua-l archive

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


On 8 July 2013 11:39, David Demelier <demelier.david@gmail.com> wrote:
Hi,

I just wanted to try the debug.debug interactive command line. The manual says :

[...] the user can inspect global and *local variables*, change their
values [...]

And just after:

[...] and so have *no direct* access to local variables [...]

So...? I'm not sure to understand, do we have access to local
variables or not? Or that means you must use functions to get them?

That's why I wrote a custom version of debug.debug() [1] which provides access to local variables. I expect it to fail in some obscure situations (like shadowing locals of the same name in a block), but it should work OK on "normal" Lua code. Also, works only on Lua 5.1 (uses setfenv).

[1] http://snippets.luacode.org/snippets/title_88