Refresh Variables registered to the luaVM

Posted by Dr. C on Thu 07 Apr 2011 10:33 AM — 2 posts, 10,366 views.

#0
Hello everyone!

Ive written a program (in C#) that reads gamevalues from memory and registers them to a luaVM.

luaVM["PlayerX"] = memory.values[3];

Like this. Since the position of the player figure changes all the time, I keep the values updated every 150ms.

while true
{
luaVM["PlayerX"] = memory.values[3];
.....
Thread.Sleep(150);
}

But I receive a SEHException (no further information) sooner or later. The time from starting the script to recieving the exception varies, and doesnt seem to be coupled with a certain event.

Visual studio doesnt tell me more, so I am a bit helpless. I think this could be somekind of overflow exception, I dont know. And I think that maybe the way of refreshing the variables to the luaVM is not right in a way. But I cannot see a better way to do this.

EDIT: The method that throws the exception seems to be:
Void lua_pushstring(IntPtr, System.String)
Doesnt tell me much..

Anyways I would be very thankful for any help.

Here what I get:
http://s7.directupload.net/file/d/2487/prmrqosv_jpg.htm
(0 is the Marshal.GetLastWin32Error)
Amended on Thu 07 Apr 2011 12:02 PM by Dr. C
Australia Forum Administrator #1
Dr C said:

Ive written a program (in C#) that reads gamevalues from memory and registers them to a luaVM.


I don't really understand this. Is this MUSHclient we are talking about?

In any case, I don't know that using threads is going to work too well in Lua (I would use coroutines).