/// <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); } }
public DebugHookEventArgs(LuaDebug luaDebug) { this.luaDebug = luaDebug; }
public DebugHookEventArgs( LuaDebug luaDebug ) { this.luaDebug = luaDebug; }
/// <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> /// 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 ); } }