blob: c9e7634efef4db801e3a1050732734bfdcc7aa79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
local hex = {}
function hex.dump(buf)
for byte=1, #buf, 16 do
local chunk = buf:sub(byte, byte+15)
io.write(string.format('%08X ',byte-1))
chunk:gsub('.', function (c) io.write(string.format('%02X ',string.byte(c))) end)
io.write(string.rep(' ',3*(16-#chunk)))
io.write(' ',chunk:gsub('%c','.'),"\n")
end
end
return hex
|