lua-users home
lua-l archive

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


Rodrigo Dias Arruda Senra <rodrigo.senra@hitecnologia.com.br> wrote:

> My current approach is to load the command (creating a new chunk) in the
> Lua state and invoke it with pcall. The problem is that I cannot write
> local variables inside the debugged target function, because the debug
> expression is a new chunk.
>
> My question is: How to change local variables (from C code) ?

You can probably do this with a special global variable table used by
debugger commands. Set a metatable on it that uses the debug API
(lua_getlocal / lua_setlocal) to manipulate local variables when they
exist.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
Fair Isle: Northeasterly 5 to 7, but easterly 4 at first in southeast.
Moderate or rough, occasionally very rough. Rain or showers. Moderate or good.