Of updating LuaInterface and of coroutine error handling

Started by
4 comments, last by swisslthr 18 years ago
I'm currently in the process of upgrading LuaInterface to work with Lua 5.1, since it hasn't been updated in quite some time and I want to experiment with the latest Lua release. So far I've done: * Updated P/Invoke bindings to deal with renamed/removed/modified functions * Reworked the OpenXXXLib functions to work with Lua 5.1 * Made lua_safetostring in the stub DLL actually safe (it now checks to make sure that it's trying to copy a string, where before it would just segfault if it wasn't) I also plan to add a few new features (like a C# equivalent of lua_gc, a way for Lua to throw .NET exceptions, a new LuaException for errors rather than just using Exception, etc.), but that will come after I get this fully stable. Mostly it's running fine, but I'm still having a few problems. Whenever I go to run any of the samples that came with LuaInterface 1.3.0, they run fine until I close them, at which point I get a segfault. If I run any code after running form.lua, it does not crash; likewise testluaform.lua doesn't crash if I run some code through it. I haven't tested socket.lua yet, but I assume it would be the same. If somebody gives me an email address or something I could send you the source - it's a bit too big to post it all in here. They're all VS2005 projects, so you'll need at least VC# and VC++ Express 2005. This part's all solved now: As a side note, I've got an issue with coroutines and I figured I might as well put it in the same thread rather than starting two at once. A coroutine in my current game project appears to be crashing out intermittently in my updated LuaInterface (but not in the old one). To try and track down what the problem is, I surrounded the call to the function with a pcall, but now I can't yield from inside that function at all ("attempt to yield across metamethod/C-call boundaries"). The game isn't text-based (and it's in C#, thus the LuaInterface), so I can't see the error that Lua is probably reporting to stdout. How can I catch that error without breaking yield? [Edited by - trevaaar on March 6, 2006 5:50:47 AM]
Advertisement
*bump*

I really need a hand with getting this to work guys
For the second case, try overwriting the lua function _ALERT. This will be called on every error lua finds and gets one string parameter.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Second problem solved now - I wasn't checking the result of coroutine.resume when I should've been. By the way, according to a quick Google _ALERT hasn't been in use since Lua 4.0.
Then they kept it for compatibility reasons i presume? It still works with Lua 5.0.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Are you going to provide the new version on the Lua resouce pages?
Would be interested as I am working on a project that is currently using Lua 5.0 / LuaInterface 1.3

This topic is closed to new replies.

Advertisement