From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "enum" |
|---|
| subject | "Format:Lua bytecode" |
|---|
| claim | "Lua 5.1 has 38 opcodes (enum OpCode in lopcodes.h, 6-bit opcode field): 0 MOVE, 1 LOADK, 2 LOADBOOL, 3 LOADNIL, 4 GETUPVAL, 5 GETGLOBAL, 6 GETTABLE, 7 SETGLOBAL, 8 SETUPVAL, 9 SETTABLE, 10 NEWTABLE, 11 SELF, 12 ADD, 13 SUB, 14 MUL, 15 DIV, 16 MOD, 17 POW, 18 UNM, 19 NOT, 20 LEN, 21 CONCAT, 22 JMP, 23 EQ, 24 LT, 25 LE, 26 TEST, 27 TESTSET, 28 CALL, 29 TAILCALL, 30 RETURN, 31 FORLOOP, 32 FORPREP, 33 TFORLOOP, 34 SETLIST, 35 CLOSE, 36 CLOSURE, 37 VARARG." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Lua bytecode" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "lua51_OpCode" |
|---|
| underlying_type | "uint8_t" |
|---|
| values | | 0 | "OP_MOVE" |
|---|
| 1 | "OP_LOADK" |
|---|
| 2 | "OP_LOADBOOL" |
|---|
| 3 | "OP_LOADNIL" |
|---|
| 4 | "OP_GETUPVAL" |
|---|
| 5 | "OP_GETGLOBAL" |
|---|
| 6 | "OP_GETTABLE" |
|---|
| 7 | "OP_SETGLOBAL" |
|---|
| 8 | "OP_SETUPVAL" |
|---|
| 9 | "OP_SETTABLE" |
|---|
| 10 | "OP_NEWTABLE" |
|---|
| 11 | "OP_SELF" |
|---|
| 12 | "OP_ADD" |
|---|
| 13 | "OP_SUB" |
|---|
| 14 | "OP_MUL" |
|---|
| 15 | "OP_DIV" |
|---|
| 16 | "OP_MOD" |
|---|
| 17 | "OP_POW" |
|---|
| 18 | "OP_UNM" |
|---|
| 19 | "OP_NOT" |
|---|
| 20 | "OP_LEN" |
|---|
| 21 | "OP_CONCAT" |
|---|
| 22 | "OP_JMP" |
|---|
| 23 | "OP_EQ" |
|---|
| 24 | "OP_LT" |
|---|
| 25 | "OP_LE" |
|---|
| 26 | "OP_TEST" |
|---|
| 27 | "OP_TESTSET" |
|---|
| 28 | "OP_CALL" |
|---|
| 29 | "OP_TAILCALL" |
|---|
| 30 | "OP_RETURN" |
|---|
| 31 | "OP_FORLOOP" |
|---|
| 32 | "OP_FORPREP" |
|---|
| 33 | "OP_TFORLOOP" |
|---|
| 34 | "OP_SETLIST" |
|---|
| 35 | "OP_CLOSE" |
|---|
| 36 | "OP_CLOSURE" |
|---|
| 37 | "OP_VARARG" |
|---|
|
|---|
| complete | true |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "typedef enum { OP_MOVE, ... } OpCode; at tag v5.1.1" |
|---|
| repo | "https://github.com/lua/lua" |
|---|
| commit | "98194db4295726069137d13b8d24fca8cbf892b6" |
|---|
| path | "lopcodes.h" |
|---|
| lines | "154-208" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "Printed luaP_opnames[] from MSVC x64 builds of tags v5.1 and v5.1.1 (identical) and disassembled self-made chunks and the 36 VLC 3.0.23 chunks with luacinfo.py; operands decoded consistently." |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Opcodes (Lua 5.1)" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T07:02:25.365Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T09:48:04.831Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read lopcodes.h at 98194db4: typedef enum OpCode has 38 names MOVE..VARARG in the same order, indexes 0-37 match the fact; complete." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T17:38:56.835Z" |
|---|
| summary | "Mark complete: counted 38 OP_ entries in enum OpCode of lopcodes.h at the cited commit, equal to the value count" |
|---|
| changed | |
|---|
|
|
|---|