LuaInterface.LuaDLL.lua_call C# (CSharp) Method

lua_call() public static method

public static lua_call ( IntPtr luaState, int nArgs, int nResults ) : int
luaState System.IntPtr
nArgs int
nResults int
return int
		public static int lua_call(IntPtr luaState, int nArgs, int nResults)
        {
            return lua_callk(luaState, nArgs, nResults, 0, IntPtr.Zero);
        }

Same methods

LuaDLL::lua_call ( IntPtr luaState, int nArgs, int nResults ) : void

Usage Example

示例#1
0
        public static int print(IntPtr L)
        {
            if (HobaDebuger.GameLogLevel < LogLevel.Log)
            {
                return(0);
            }

            // For each argument we'll 'tostring' it
            int    n = LuaDLL.lua_gettop(L);
            string s = String.Empty;

            LuaDLL.lua_getglobal(L, "tostring");

            for (int i = 1; i <= n; i++)
            {
                LuaDLL.lua_pushvalue(L, -1);                  /* function to be called */
                LuaDLL.lua_pushvalue(L, i);                   /* value to print */
                LuaDLL.lua_call(L, 1, 1);

                string ret = LuaDLL.lua_tostring(L, -1);
                if (ret == null)
                {
                    HobaDebuger.LogError("!!!! lua print return null*");
                }
                else
                {
                    s += ret;
                }

                if (i < n)
                {
                    s += "\t";
                }

                LuaDLL.lua_pop(L, 1);                  /* pop result */
            }

#if !SERVER_USE
            if (!EntryPoint.Instance.IsInited)
            {
                LuaDLL.HOBA_LogString(HobaText.Format("print LUA: {0}", s));
            }
#endif
            HobaDebuger.LogFormat("LUA: {0}", s);

            return(0);
        }
All Usage Examples Of LuaInterface.LuaDLL::lua_call
LuaDLL