diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-03-19 15:31:08 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-03-19 15:31:08 -0300 |
| commit | f53eabeed855081fa38e9af5cf7c977915f5213f (patch) | |
| tree | 1e116377bb3666a36f76220a22e9149549b31975 /testes | |
| parent | 39bb3cf2422603d854ee12529cc3419dc735802a (diff) | |
| download | lua-github-c6f7181e910b6.tar.gz | |
Small changes in the header of binary filesc6f7181e910b6
- LUAC_VERSION is equal to LUA_VERSION_NUM, and it is stored
as an int.
- 'sizeof(int)' and 'sizeof(size_t)' removed from the header, as
the binary format does not depend on these sizes. (It uses its
own serialization for unsigned integer values.)
Diffstat (limited to 'testes')
| -rw-r--r-- | testes/calls.lua | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/testes/calls.lua b/testes/calls.lua index f5108a47..941493b1 100644 --- a/testes/calls.lua +++ b/testes/calls.lua @@ -397,17 +397,15 @@ assert((function (a) return a end)() == nil) print("testing binary chunks") do - local header = string.pack("c4BBc6BBBBBj", - "\27Lua", -- signature - 5*16 + 4, -- version 5.4 - 0, -- format - "\x19\x93\r\n\x1a\n", -- data - string.packsize("i"), -- sizeof(int) - string.packsize("T"), -- sizeof(size_t) - 4, -- size of instruction - string.packsize("j"), -- sizeof(lua integer) - string.packsize("n"), -- sizeof(lua number) - 0x5678 -- LUAC_INT + local header = string.pack("c4BBBc6BBBj", + "\27Lua", -- signature + (504 >> 7) & 0x7f, (504 & 0x7f) | 0x80, -- version 5.4 (504) + 0, -- format + "\x19\x93\r\n\x1a\n", -- data + 4, -- size of instruction + string.packsize("j"), -- sizeof(lua integer) + string.packsize("n"), -- sizeof(lua number) + 0x5678 -- LUAC_INT -- LUAC_NUM may not have a unique binary representation (padding...) ) local c = string.dump(function () local a = 1; local b = 3; return a+b*3 end) |
