From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:Lua bytecode" |
|---|
| claim | "The Lua 5.5 chunk header is 40 bytes on a 64-bit default build: signature, 0x55, format 0, LUAC_DATA, then (size, value) pairs: sizeof(int) + LUAC_INT -0x5678 as int, sizeof(Instruction) + LUAC_INST 0x12345678, sizeof(lua_Integer) + -0x5678, sizeof(lua_Number) + LUAC_NUM -370.5. One byte with the main function's upvalue count follows." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Lua bytecode" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "lua55_header" |
|---|
| size | 40 |
|---|
| fields | | offset | 0 |
|---|
| size | 4 |
|---|
| type | "char[4]" |
|---|
| name | "signature" |
|---|
|
| offset | 4 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "version" |
|---|
| notes | "0x55" |
|---|
|
| offset | 5 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "format" |
|---|
|
| offset | 6 |
|---|
| size | 6 |
|---|
| type | "char[6]" |
|---|
| name | "luac_data" |
|---|
| notes | "19 93 0D 0A 1A 0A" |
|---|
|
| offset | 12 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "sizeof_int" |
|---|
| notes | "4" |
|---|
|
| offset | 13 |
|---|
| size | 4 |
|---|
| type | "int32_t" |
|---|
| name | "luac_int_as_int" |
|---|
| notes | "-0x5678 = 88 A9 FF FF" |
|---|
|
| offset | 17 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "sizeof_Instruction" |
|---|
| notes | "4" |
|---|
|
| offset | 18 |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "luac_inst" |
|---|
| notes | "0x12345678" |
|---|
|
| offset | 22 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "sizeof_lua_Integer" |
|---|
| notes | "8" |
|---|
|
| offset | 23 |
|---|
| size | 8 |
|---|
| type | "int64_t" |
|---|
| name | "luac_int" |
|---|
| notes | "-0x5678" |
|---|
|
| offset | 31 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "sizeof_lua_Number" |
|---|
| notes | "8" |
|---|
|
| offset | 32 |
|---|
| size | 8 |
|---|
| type | "double" |
|---|
| name | "luac_num" |
|---|
| notes | "-370.5" |
|---|
|
|
|---|
| endianness | "native" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "dumpNumInfo macro and dumpHeader (tag v5.5.1); LUAC_INT -0x5678, LUAC_INST 0x12345678, LUAC_NUM -370.5 in lundump.h lines 20-22" |
|---|
| repo | "https://github.com/lua/lua" |
|---|
| commit | "7579fc9d7ed90240487251dfb69168f8e64e9294" |
|---|
| path | "ldump.c" |
|---|
| lines | "269-282" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "MSVC x64 builds of 5.5.0 and 5.5.1 write 1B 4C 75 61 55 00 19 93 0D 0A 1A 0A 04 88 A9 FF FF 04 78 56 34 12 08 88 A9 FF FF FF FF FF FF 08 00 00 00 00 00 28 77 C0, then 01." |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Header (Lua 5.5)" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T07:00:30.954Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T17:28:43.284Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read dumpNumInfo and dumpHeader in ldump.c at the cited commit: signature, version, format, LUAC_DATA, then (size byte, value) for int/LUAC_INT, Instruction/LUAC_INST, lua_Integer/LUAC_INT, lua_Number/LUAC_NUM; offsets 12,13,17,18,22,23,31,32 and total 40 on a default 64-bit build; dumpByte(sizeupvalues) follows." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T17:08:37.749Z" |
|---|
| summary | "Add data.endianness native: dumpNumInfo writes each value in host byte order (ldump.c 269-282) and the loader rejects a mismatching chunk. Offsets and values (LUAC_INT -0x5678, LUAC_INST 0x12345678…" |
|---|
| changed | |
|---|
|
|
|---|