示例#1
0
    def setlist(self, vm: LuaVM):
        a, b, c = self.getAbc()
        a += 1
        if c > 0:
            c -= 1
        else:
            c = Instruction(vm.Fetch()).getAx()

        bisZero = b is 0
        if bisZero:
            b = (vm.ToInteger(-1)) - a - 1
            vm.Pop(1)

        vm.CheckStack(1)
        index = c * LuaTable.LFIELDS_PER_FLUSH

        for i in range(1, b + 1):
            index += 1
            vm.PushValue(a + i)
            vm.SetI(a, index)

        if bisZero:
            for i in range(vm.RegisterCount() + 1, vm.GetTop() + 1):
                index += 1
                vm.PushValue(i)
                vm.SetI(a, index)
            vm.SetTop(vm.RegisterCount())
示例#2
0
 def _pushFuncAndArgs(self, a: int, b: int, vm: LuaVM) -> int:
     if b >= 1:
         vm.CheckStack(b)
         for i in range(a, a + b):
             vm.PushValue(i)
         return b - 1
     else:
         self._fixStack(a, vm)
         return vm.GetTop() - vm.RegisterCount() - 1