Esempio n. 1
0
        internal static int print(IntPtr L)
        {
            int n = LuaDLL.lua_gettop(L);

            s.Length = 0;

            LuaDLL.lua_getglobal(L, "tostring");

            for (int i = 1; i <= n; i++)
            {
                if (i > 1)
                {
                    s.Append("    ");
                }

                LuaDLL.lua_pushvalue(L, -1);
                LuaDLL.lua_pushvalue(L, i);

                LuaDLL.lua_call(L, 1, 1);
                s.Append(LuaDLL.lua_tostring(L, -1));
                LuaDLL.lua_pop(L, 1);
            }
            LuaDLL.lua_settop(L, n);

            if (printTrace
#if UNITY_EDITOR
                && SLuaSetting.Instance.PrintTrace
#endif
                )
            {
                LuaDLL.lua_getglobal(L, "debug");
                LuaDLL.lua_getfield(L, -1, "traceback");
                LuaDLL.lua_call(L, 0, 1);
                s.Append("\n");
                s.Append(LuaDLL.lua_tostring(L, -1));

                LuaDLL.lua_pop(L, 2);
            }

            Logger.Log(s.ToString(), true);

            LuaState state = LuaState.get(L);
            if (state.logDelegate != null)
            {
                state.logDelegate(s.ToString());
            }

            return(0);
        }
Esempio n. 2
0
        internal static int warn(IntPtr L)
        {
            int    n   = LuaDLL.lua_gettop(L);
            string str = stackString(L, n);

            Logger.LogWarning("[LUA]" + str);
            LuaState state = LuaState.get(L);

            if (state.logDelegate != null)
            {
                state.logDelegate(s.ToString());
            }

            LuaDLL.lua_settop(L, n);

            return(0);
        }
Esempio n. 3
0
        internal static int print(IntPtr L)
        {
            int    n   = LuaDLL.lua_gettop(L);
            string str = stackString(L, n);

            Logger.Log(str, true);

            LuaState state = LuaState.get(L);

            if (state.logDelegate != null)
            {
                state.logDelegate(s.ToString());
            }

            LuaDLL.lua_settop(L, n);

            return(0);
        }