void DebugHookCallback(lua_State L, IntPtr luaDebug) { lua_getstack(L, 0, luaDebug); if (!Lua.GetInfo(L, "Snlu", luaDebug)) { return; } var debug = LuaDebug.FromIntPtr(luaDebug); DebugHookCallbackInternal(debug); }
private void DebugHookCallbackInternal(LuaDebug luaDebug) { try { var temp = DebugHook; if (temp != null) { temp(this, new DebugHookEventArgs(luaDebug)); } } catch (Exception ex) { OnHookException(new HookExceptionEventArgs(ex)); } }
public static string SetLocal(lua_State L, LuaDebug ar, int n) { IntPtr pDebug = Marshal.AllocHGlobal(Marshal.SizeOf(ar)); string ret = string.Empty; try { Marshal.StructureToPtr(ar, pDebug, false); ret = SetLocal(L, pDebug, n); ar = LuaDebug.FromIntPtr(pDebug); } finally { Marshal.FreeHGlobal(pDebug); } return(ret); }
public static int GetStack(lua_State L, int level, ref LuaDebug ar) { IntPtr pDebug = Marshal.AllocHGlobal(Marshal.SizeOf(ar)); int ret = 0; try { Marshal.StructureToPtr(ar, pDebug, false); ret = lua_getstack(L, level, pDebug); ar = LuaDebug.FromIntPtr(pDebug); } finally { Marshal.FreeHGlobal(pDebug); } return(ret); }
public static bool GetInfo(lua_State L, string what, ref LuaDebug ar) { IntPtr pDebug = Marshal.AllocHGlobal(Marshal.SizeOf(ar)); bool ret = false; try { Marshal.StructureToPtr(ar, pDebug, false); ret = lua_getinfo(L, what, pDebug) != 0; ar = LuaDebug.FromIntPtr(pDebug); } finally { Marshal.FreeHGlobal(pDebug); } return(ret); }
public bool GetInfo(string what, ref LuaDebug ar) { return(Lua.GetInfo(L, what, ref ar)); }
public int GetStack(int level, ref LuaDebug ar) { return(Lua.GetStack(L, level, ref ar)); }
public string SetLocal(LuaDebug luaDebug, int n) { return(Lua.SetLocal(L, luaDebug, n)); }
public DebugHookEventArgs(LuaDebug luaDebug) { LuaDebug = luaDebug; }