[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: About lua_State's clone and dostring that can change a local variable
- From: cielacanth <cielacanth@...>
- Date: Fri, 08 Feb 2008 20:25:35 +0900
Now I'm writing the lua debugger and have two questions.
1, lua_State's clone
I want to debug not only the lua program that has the main function
but also the program that is called from c language side many times.
And, I want to change the lua program immediately when there is an error
in the each call, and to restart from the called point.
In a word, I want to make the mistaken call not to be.
I think it is neccesary to clone lua_State object including a global
state for this,
and is it possible to do it ?
2, dostring that can change a local variable
In the hook function, I sometimes want to execute some lua program
in the context of the running function at that time.
(For instance it changes the value of local variable of that function.)
When lua_loadstring and lua_call is simply executed from the hook function,
it is considered that it is globally executed.
So it is not easy to change the value of the local variable unlike the
I need the function like dostring that can execute programs in context
of a specified function.
(In the following, I call it 'special_dostring'.)
local a = 0
... -- (A)
If the hook function is called immediately before the execution of the
special_dostring("a=100", [infomation of the function foo]) changes the
value of the variable a
of the function foo.
Is it possible to write such a API ?