I am using an assembly called LuaInterface to run lua code inside my C # application. At lua runtime, I create some WinForms and map event handlers (lua-methods) for them.
The problem is that the doString (aka runLuaCode ) method only starts the initialization procedure and the constructors. This is fine and intended, however the doString function acts without blocking, so the function returns while the Lua-Forms created still exist. This means that any exception (null-ref and similar) that does not occur during the constructor is not handled by lua error handling, which happens with an error until my editor wndProc, which most likely kills my editor and does error handling almost impossible.
Is there a way to create a new Thread / Process / AppDomain that processes its own WndProc, so that only this subtask should handle exceptions?
Should I block my editor in doString with a while loop in lua until the forms are closed?
What other parameters do I have?
Any advice on this is greatly appreciated!
source share