Esempio n. 1
0
File: Lua.cs Progetto: bmk10/NLua
        private static void DebugHookCallback(LuaState luaState, LuaDebug luaDebug)
        {
            var translator = ObjectTranslatorPool.Instance.Find(luaState);
            var lua        = translator.Interpreter;

            lua.DebugHookCallbackInternal(luaState, luaDebug);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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));
            }
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
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);
            }
        }
Esempio n. 6
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));
     }
 }
Esempio n. 7
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);
            }
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
 static void DebugHookCallback(LuaState luaState, long luaDebug)
 {
     IntPtr   ptr   = new IntPtr(luaDebug);
     LuaDebug debug = System.Runtime.InteropServices.Marshal.PtrToStructure <LuaDebug> (ptr);
Esempio n. 10
0
 static void DebugHookCallback(LuaState luaState, LuaDebug debug)
 {
Esempio n. 11
0
 public int GetInfo(string what, ref LuaDebug ar)
 {
     return(LuaCore.LuaGetInfo(luaState, what, ref ar));
 }
Esempio n. 12
0
 public int GetStack(int level, ref LuaDebug ar)
 {
     return(LuaCore.LuaGetStack(luaState, level, ref ar));
 }
Esempio n. 13
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>
 public string SetLocal(LuaDebug luaDebug, int n)
 {
     return(LuaCore.LuaSetLocal(luaState, luaDebug, n).ToString());
 }
Esempio n. 14
0
 /// <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));
 }
Esempio n. 15
0
 public DebugHookEventArgs(LuaDebug luaDebug)
 {
     this.luaDebug = luaDebug;
 }
Esempio n. 16
0
 public bool GetInfo(string what, ref LuaDebug ar)
 {
     return(luaState.GetInfo(what, ref ar));
 }
Esempio n. 17
0
 public int GetStack(int level, ref LuaDebug ar)
 {
     return(luaState.GetStack(level, ref ar));
 }
Esempio n. 18
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>
 public string SetLocal(LuaDebug luaDebug, int n)
 {
     return(luaState.SetLocal(luaDebug, n));
 }