Exemplo 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);
        }
Exemplo 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));
            }
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 6
0
 public bool GetInfo(string what, ref LuaDebug ar)
 {
     return(Lua.GetInfo(L, what, ref ar));
 }
Exemplo n.º 7
0
 public int GetStack(int level, ref LuaDebug ar)
 {
     return(Lua.GetStack(L, level, ref ar));
 }
Exemplo n.º 8
0
 public string SetLocal(LuaDebug luaDebug, int n)
 {
     return(Lua.SetLocal(L, luaDebug, n));
 }
Exemplo n.º 9
0
 public DebugHookEventArgs(LuaDebug luaDebug)
 {
     LuaDebug = luaDebug;
 }