diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-11-12 19:14:09 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-11-12 19:14:09 +1100 |
| commit | 8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de (patch) | |
| tree | 02b6cf23f591915747ec2994381854a79979c4a0 /lib/esp-idf-lua/examples/vfs/spiffs_image/hex.lua | |
| parent | 8471046a95ab9e00f7d42b56dbbc9ce3e5b424b9 (diff) | |
| download | tangara-fw-8a0a167adbf3d9b6f8b6f16aaf20ca39ad5549de.tar.gz | |
Convert the main menu screen to lua lol
Diffstat (limited to 'lib/esp-idf-lua/examples/vfs/spiffs_image/hex.lua')
| -rw-r--r-- | lib/esp-idf-lua/examples/vfs/spiffs_image/hex.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/esp-idf-lua/examples/vfs/spiffs_image/hex.lua b/lib/esp-idf-lua/examples/vfs/spiffs_image/hex.lua new file mode 100644 index 00000000..c9e7634e --- /dev/null +++ b/lib/esp-idf-lua/examples/vfs/spiffs_image/hex.lua @@ -0,0 +1,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 |
