[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: AW: LuaInterface & threads
- From: "steffenj" <steffenj@...>
- Date: Sat, 20 Aug 2005 21:36:03 +0200
i like it when i can answer my own questions ;)
after some poking around, i found that i could just call debug.getinfo the
public void Callback()
object tInfo = lua.GetFunction("debug.getinfo").Call(2);
button1.Text = "i just called, to say, hellooo-ho!";
Also, i was able to work around the thread problem by using a callback
function which i call from the hook function, and doing the Suspend on C#
side. The callback is registered like this:
lua.RegisterFunction("Callback", this, typeof(Form1).GetMethod("Callback"));
[mailto:firstname.lastname@example.org] Im Auftrag von steffenj
Gesendet: Samstag, 20. August 2005 18:26
Betreff: LuaInterface & threads
I intend to write a Lua debugger in C# via LuaInterface. I don't see the
debug facility exposed to C# programs, is this correct?
Currently, i'm trying to debug by using debug.sethook from within the lua
script. When the hook (a lua function) gets called, i want to suspend the
thread that does the lua.DoString("...") call, the thread is created like
luaThread = new Thread(new ThreadStart(LuaDoStringThread));
But when i do
luaThread:Suspend() -- in lua's hook function
(note that luaThread.Suspend() raises a "invalid arguments to method call"
luaThread.Resume() -- in C#
i get an exception that the thread hasn't been suspended manually or so.
I also looked into luaThread.Sleep() but oddly, in Lua this method is a
table with the following member:
[".fqn"] = value;
Correspondingly, when i try to call it, all i get is the exception:
[string "chunk"]:23: No such type: value
So far, i can only slow down the script by adding a "for" loop in the hook
function. The textbox i write to is correctly updated, so i can see what
happens when the script runs. But i want to be able to actually set a
breakpoint and suspend the script, while inspecting variables, call stack,
etc. How would i go about this?
I would appreciate any help or hints!