lua-users home
lua-l archive

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


I think you should read the samples included with the standard lua distribution. There's a sample program doing exactly what you said.

download the source of lua 5.1.4 and see the "test/trace-globals.lua" you should get some idea.

On Sat, Dec 6, 2008 at 6:55 PM, Stevo <steve.bn@gmx.net> wrote:
Hello,
i am developing a small application for controlling a robot unit. In this program is use lua to run scripts which move the robot by calling the functions of the c program. This works fine but now i would like to implement a variable monitor, to display the value of e.g. the counter of a for-loop in the GUI of the c-program.

The easiest implemetation for me would be to pass another c-function to lua which can be added in the script to pass the value of the desired variable and update the view. But this is also the least elegant solution ;)

I read a bit into the lua-debug-facilities but i did not really understand if monitoring variables is possible with it.

The third thing is the variable lua_getglobal. Is it possible to call it periodically in the C-programm while the script is running? I read the function takes the variable from the stack so i guess it is only valid to call lua_getglobal when the skript has finished?

Thanks in advance for your help!
(and sorry for my bad english ;)

Greeting
 Steve