summaryrefslogtreecommitdiff
path: root/lib/supportlib.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lib/supportlib.lua')
-rw-r--r--lib/supportlib.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/supportlib.lua b/lib/supportlib.lua
index 961c2c3..8565b8e 100644
--- a/lib/supportlib.lua
+++ b/lib/supportlib.lua
@@ -1,3 +1,7 @@
+--
+-- Dumps a file to the screen.
+--
+
function display(inp, n)
local i
if (type(inp) == "string") then
@@ -17,6 +21,11 @@ function display(inp, n)
end
end
+
+--
+-- Squash characters into printable chars.
+--
+
function pchar(n)
if (not ((n >= 32) and (n <= 127))) then
n = 46 -- aka '.' or 0x2e
@@ -24,6 +33,11 @@ function pchar(n)
return hex(n, "%c")
end
+
+--
+-- Does a hexadecimal dump on the screen of the file.
+--
+
function hexdump(inp, from, to, width)
local size, nlines, remaining, data_array, line, byte, outstring