[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Evaluate expressions that modify local variables
- From: Tony Finch <dot@...>
- Date: Tue, 24 Apr 2012 16:58:44 +0100
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.