Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private void DebugHookCallbackInternal(LuaDebug luaDebug)
        {
            try
            {
                var temp = DebugHook;

                if (temp != null)
                {
                    temp(this, new DebugHookEventArgs(luaDebug));
                }
            }
            catch (Exception ex)
            {
                OnHookException(new HookExceptionEventArgs(ex));
            }
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
 public bool GetInfo(string what, ref LuaDebug ar)
 {
     return(Lua.GetInfo(L, what, ref ar));
 }
Esempio n. 7
0
 public int GetStack(int level, ref LuaDebug ar)
 {
     return(Lua.GetStack(L, level, ref ar));
 }
Esempio n. 8
0
 public string SetLocal(LuaDebug luaDebug, int n)
 {
     return(Lua.SetLocal(L, luaDebug, n));
 }
Esempio n. 9
0
 public DebugHookEventArgs(LuaDebug luaDebug)
 {
     LuaDebug = luaDebug;
 }