Beispiel #1
0
        /// <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);
            }
        }
Beispiel #2
0
        /// <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);
            }
        }
Beispiel #3
0
 /// <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));
     }
 }
Beispiel #4
0
        /// <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);
            }
        }
Beispiel #5
0
 public DebugHookEventArgs(LuaDebug luaDebug)
 {
     this.luaDebug = luaDebug;
 }
Beispiel #6
0
 public DebugHookEventArgs( LuaDebug luaDebug )
 {
     this.luaDebug = luaDebug;
 }
Beispiel #7
0
 /// <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 );
     }
 }
Beispiel #8
0
 /// <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 );
     }
 }
Beispiel #9
0
 /// <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 );
     }
 }