private static void DebugHookCallback(LuaState luaState, LuaDebug luaDebug) { var translator = ObjectTranslatorPool.Instance.Find(luaState); var lua = translator.Interpreter; lua.DebugHookCallbackInternal(luaState, luaDebug); }
static void DebugHookCallback(LuaState luaState, IntPtr luaDebug) { LuaDebug debug = (LuaDebug)System.Runtime.InteropServices.Marshal.PtrToStructure(luaDebug, typeof(LuaDebug)); #endif ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(luaState); Lua lua = translator.Interpreter; lua.DebugHookCallbackInternal(luaState, debug); }
private void DebugHookCallbackInternal(LuaState luaState, LuaDebug luaDebug) { try { var temp = DebugHook; if (temp != null) { temp(this, new DebugHookEventArgs(luaDebug)); } } catch (Exception ex) { OnHookException(new HookExceptionEventArgs(ex)); } }
/// <summary> /// Sets local (see lua docs) /// </summary> /// <param name="luaDebug">lua debug structure</param> /// <param name="n">see lua docs</param> /// <returns>see lua docs</returns> /// <author>Reinhard Ostermeier</author> public String SetLocal(LuaDebug luaDebug, int n) { IntPtr ld = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(luaDebug)); System.Runtime.InteropServices.Marshal.StructureToPtr(luaDebug, ld, false); try { return(LuaDLL.lua_setlocal(luaState, ld, n)); } finally { System.Runtime.InteropServices.Marshal.FreeHGlobal(ld); } }
/// <summary> /// Gets info (see lua docs) /// </summary> /// <param name="what">what (see lua docs)</param> /// <param name="luaDebug">lua debug structure</param> /// <returns>see lua docs</returns> /// <author>Reinhard Ostermeier</author> public int GetInfo(String what, ref LuaDebug luaDebug) { IntPtr ld = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(luaDebug)); System.Runtime.InteropServices.Marshal.StructureToPtr(luaDebug, ld, false); try { return(LuaDLL.lua_getinfo(luaState, what, ld)); } finally { luaDebug = (LuaDebug)System.Runtime.InteropServices.Marshal.PtrToStructure(ld, typeof(LuaDebug)); System.Runtime.InteropServices.Marshal.FreeHGlobal(ld); } }
/// <summary> /// Delegate that is called on lua hook callback /// </summary> /// <param name="luaState">lua state</param> /// <param name="luaDebug">Pointer to LuaDebug (lua_debug) structure</param> /// <author>Reinhard Ostermeier</author> private void DebugHookCallback(IntPtr luaState, IntPtr luaDebug) { try { LuaDebug ld = (LuaDebug)System.Runtime.InteropServices.Marshal.PtrToStructure(luaDebug, typeof(LuaDebug)); EventHandler <DebugHookEventArgs> temp = DebugHook; if (temp != null) { temp(this, new DebugHookEventArgs(ld)); } } catch (Exception ex) { OnHookException(new HookExceptionEventArgs(ex)); } }
/// <summary> /// Gets the stack entry on a given level /// </summary> /// <param name="level">level</param> /// <param name="luaDebug">lua debug structure</param> /// <returns>Returns true if level was allowed, false if level was invalid.</returns> /// <author>Reinhard Ostermeier</author> public bool GetStack(int level, out LuaDebug luaDebug) { luaDebug = new LuaDebug(); IntPtr ld = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(luaDebug)); System.Runtime.InteropServices.Marshal.StructureToPtr(luaDebug, ld, false); try { return(LuaDLL.lua_getstack(luaState, level, ld) != 0); } finally { luaDebug = (LuaDebug)System.Runtime.InteropServices.Marshal.PtrToStructure(ld, typeof(LuaDebug)); System.Runtime.InteropServices.Marshal.FreeHGlobal(ld); } }
static void DebugHookCallback(IntPtr luaState, IntPtr luaDebug) { var state = LuaState.FromIntPtr(luaState); state.GetStack(0, luaDebug); if (!state.GetInfo("Snlu", luaDebug)) { return; } var debug = LuaDebug.FromIntPtr(luaDebug); ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(state); Lua lua = translator.Interpreter; lua.DebugHookCallbackInternal(state, debug); }
static void DebugHookCallback(LuaState luaState, long luaDebug) { IntPtr ptr = new IntPtr(luaDebug); LuaDebug debug = System.Runtime.InteropServices.Marshal.PtrToStructure <LuaDebug> (ptr);
static void DebugHookCallback(LuaState luaState, LuaDebug debug) {
public int GetInfo(string what, ref LuaDebug ar) { return(LuaCore.LuaGetInfo(luaState, what, ref ar)); }
public int GetStack(int level, ref LuaDebug ar) { return(LuaCore.LuaGetStack(luaState, level, ref ar)); }
/// <summary> /// Sets local (see lua docs) /// </summary> /// <param name = "luaDebug">lua debug structure</param> /// <param name = "n">see lua docs</param> /// <returns>see lua docs</returns> public string SetLocal(LuaDebug luaDebug, int n) { return(LuaCore.LuaSetLocal(luaState, luaDebug, n).ToString()); }
/// <summary> /// Gets local (see lua docs) /// </summary> /// <param name = "luaDebug">lua debug structure</param> /// <param name = "n">see lua docs</param> /// <returns>see lua docs</returns> public string GetLocal(LuaDebug luaDebug, int n) { return(_luaState.GetLocal(luaDebug, n)); }
public DebugHookEventArgs(LuaDebug luaDebug) { this.luaDebug = luaDebug; }
public bool GetInfo(string what, ref LuaDebug ar) { return(luaState.GetInfo(what, ref ar)); }
public int GetStack(int level, ref LuaDebug ar) { return(luaState.GetStack(level, ref ar)); }
/// <summary> /// Sets local (see lua docs) /// </summary> /// <param name = "luaDebug">lua debug structure</param> /// <param name = "n">see lua docs</param> /// <returns>see lua docs</returns> public string SetLocal(LuaDebug luaDebug, int n) { return(luaState.SetLocal(luaDebug, n)); }