Esempio n. 1
0
        public IList <object> Call(params object[] args)
        {
            var topIndex = LuaCore.GetTop(_luaState);

            var runtime = LuaRuntimePool.GetRuntime(_luaState);

            if (_func != null)
            {
                DataHelper.PushObject(_luaState, _func);
            }
            else
            {
                LuaCore.GlobalRawGet(_luaState, _reference);
            }
            foreach (var arg in args)
            {
                DataHelper.PushObject(_luaState, arg);
            }
            if (LuaCore.Call(_luaState, args.Length, -1, 0) == 0)
            {
                return(runtime.ObjectMgr.PopResults(_luaState, topIndex));
            }
            runtime.ThrowExceptionFromError(_luaState, topIndex);
            return(null);
        }
Esempio n. 2
0
 internal void Push(ScriptState luaState)
 {
     LuaCore.GlobalRawGet(luaState, _index);
 }