Exemplo n.º 1
0
 def _fixStack(a: int, vm: LuaVM):
     x = vm.ToInteger(-1)
     vm.Pop(1)
     vm.CheckStack(x - a)
     for i in range(a, x):
         vm.PushValue(i)
     vm.Rotate(vm.RegisterCount() + 1, x - a)
Exemplo n.º 2
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())