From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:Lua bytecode" |
|---|
| claim | "The Lua 5.2 chunk header is 18 bytes: the 12 bytes of the 5.1 layout with version 0x52, then LUAC_TAIL 19 93 0D 0A 1A 0A. No upvalue-count byte follows (the main function starts at offset 18)." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Lua bytecode" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "lua52_header" |
|---|
| size | 18 |
|---|
| fields | | offset | 0 |
|---|
| size | 4 |
|---|
| type | "char[4]" |
|---|
| name | "signature" |
|---|
| notes | "1B 4C 75 61" |
|---|
|
| offset | 4 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "version" |
|---|
| notes | "0x52" |
|---|
|
| offset | 5 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "format" |
|---|
| notes | "0" |
|---|
|
| offset | 6 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "endianness" |
|---|
| notes | "1 = little" |
|---|
|
| offset | 7 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "sizeof_int" |
|---|
|
| offset | 8 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "sizeof_size_t" |
|---|
|
| offset | 9 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "sizeof_Instruction" |
|---|
|
| offset | 10 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "sizeof_lua_Number" |
|---|
|
| offset | 11 |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "integral" |
|---|
|
| offset | 12 |
|---|
| size | 6 |
|---|
| type | "char[6]" |
|---|
| name | "tail" |
|---|
| notes | "19 93 0D 0A 1A 0A" |
|---|
|
|
|---|
| endianness | "native" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "luaU_header() (tag v5.2.3); LUAC_TAIL and LUAC_HEADERSIZE in lundump.h lines 23-26" |
|---|
| repo | "https://github.com/lua/lua" |
|---|
| commit | "7ea44b56a883857dc7ba28bd99406491034e254c" |
|---|
| path | "lundump.c" |
|---|
| lines | "244-258" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "MSVC x64 builds of 5.2.0-5.2.3 write 1B 4C 75 61 52 00 01 04 08 04 08 00 19 93 0D 0A 1A 0A, followed directly by linedefined." |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Header (Lua 5.2)" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T07:00:30.710Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T17:28:43.046Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read luaU_header in lundump.c at the cited commit: the same 12 bytes as 5.1 followed by memcpy of LUAC_TAIL (6 bytes) = 18; byte 6 is *(char*)&x." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T17:08:37.504Z" |
|---|
| summary | "Add data.endianness native: header byte 6 holds the dumping host's order (lundump.c 251, '*(char*)&x') and the loader compares the header bytes with its own, so only same-order chunks load." |
|---|
| changed | |
|---|
|
|
|---|