From 875e91636b1b4930736a73768b130b7c07dfeecb Mon Sep 17 00:00:00 2001 From: CPunch Date: Thu, 11 Aug 2022 16:49:48 -0500 Subject: [PATCH] lundump.py: SETGLOBAL uses K[] --- README.md | 4 ++-- lundump.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a219d2e..afdc090 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ example.luac [ 0] LOADK : R[0] K[1] ; load "pri" into R[0] [ 1] LOADK : R[1] K[2] ; load "nt" into R[1] -[ 2] CONCAT : R[0] R[0] R[1] ; concat 2 values from R[0] to R[1] -[ 3] SETGLOBAL : R[0] R[0] ; +[ 2] CONCAT : R[0] R[0] R[1] ; concat 2 values from R[0] to R[1], store into R[0] +[ 3] SETGLOBAL : R[0] K[0] ; [ 4] EQ : R[0] K[3] K[3] ; [ 5] JMP : R[0] R[5] ; [ 6] GETGLOBAL : R[0] K[4] ; diff --git a/lundump.py b/lundump.py index da64ec0..6c462b8 100644 --- a/lundump.py +++ b/lundump.py @@ -68,7 +68,7 @@ class ConstType(IntEnum): _RKBCInstr = [Opcodes.SETTABLE, Opcodes.ADD, Opcodes.SUB, Opcodes.MUL, Opcodes.DIV, Opcodes.MOD, Opcodes.POW, Opcodes.EQ, Opcodes.LT] _RKCInstr = [Opcodes.GETTABLE, Opcodes.SELF] -_KBx = [Opcodes.LOADK, Opcodes.GETGLOBAL] +_KBx = [Opcodes.LOADK, Opcodes.GETGLOBAL, Opcodes.SETGLOBAL] # is an 'RK' value a K? (result is true for K, false for R) def whichRK(rk: int): @@ -130,7 +130,7 @@ class Instruction: return "load %s into R[%d]" % (chunk.getConstant(self.B).toCode(), self.A) elif self.opcode == Opcodes.CONCAT: count = self.C - self.B + 1 - return "concat %d values from R[%d] to R[%d]" % (count, self.B, self.C) + return "concat %d values from R[%d] to R[%d], store into R[%d]" % (count, self.B, self.C, self.A) else: return ""