public void Init(object cbase) { if (pLuaVM != null) { pLuaVM.DebugHook -= new EventHandler<DebugHookEventArgs>(pLuaVM_DebugHook); pLuaVM.RemoveDebugHook(); try { pLuaVM.Close(); } catch { } System.Threading.Thread.Sleep(1); if (AsyncThread != null) Terminate(); } baseClass = cbase; baseType = cbase.GetType(); baseCallback = baseType.GetMethod("Callback"); pLuaVM = new Lua(); pLuaFuncs = new Hashtable(); registerLuaFunctions(new LUAVMCommands()); pLuaVM.SetDebugHook(EventMasks.LUA_MASKCOUNT, CommandsPerUpdate); pLuaVM.DebugHook += new EventHandler<DebugHookEventArgs>(pLuaVM_DebugHook); }