예제 #1
0
        public LuaObject PopResult()
        {
            var len = stackLen;

            if (len == 0)
            {
                return(vm.nil);
            }
            else if (len == 1)
            {
                return(Pop());
            }
            else
            {
                return(vm.GetTuple(Take(len)));
            }
        }
예제 #2
0
 public void IPairs(StackFrame stackFrame, LuaObject[] args)
 {
     if (args.Length == 0)
     {
         stackFrame.Push(vm.GetTuple(new[] { iterFunc }));
     }
     else
     {
         var table = args[0] as LuaTable;
         if (table == null)
         {
             stackFrame.Push(vm.GetTuple(new[] { iterFunc }));
         }
         else if (table.status != LuaTable.Status.List)
         {
             stackFrame.Push(vm.GetTuple(new[] { iterFunc }));
         }
         else if (table.Count == 0)
         {
             stackFrame.Push(vm.GetTuple(new[] { iterFunc }));
         }
         else
         {
             stackFrame.Push(vm.GetTuple(new[] { iterFunc, args[0], vm.GetNumber(0) }));
         }
     }
 }