viruscamp / luadec

Lua Decompiler for lua 5.1 , 5.2 and 5.3
1.14k stars 343 forks source link

OP_CLOSURE decompiles incorrectly if Lua uses non-standard opcode order #74

Open jalbert-dev opened 4 years ago

jalbert-dev commented 4 years ago

Normal Lua stores opcode and operands in 32 bits in Op-A-C-B order, but I have an implementation here that uses a different ordering which caused OP_CLOSURE to decompile incorrectly. I found that the decompiler looks in register C for the function index, but this is wrong; it should look in Bx. I've made a PR to fix this issue (#73).

The disassembler already has the correct behaviour, so no changes are necessary there.