summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/supportlib.lua14
-rw-r--r--lib/tasklib.lua15
2 files changed, 29 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
diff --git a/lib/tasklib.lua b/lib/tasklib.lua
new file mode 100644
index 0000000..bfb6cca
--- /dev/null
+++ b/lib/tasklib.lua
@@ -0,0 +1,15 @@
+--
+-- Create some simple bindings for the LuaTask system to hide the various ugly yields.
+--
+
+function HttpClient(url)
+ return coroutine.yield("HttpClient", url))
+end
+
+function Command(command, ...)
+ return coroutine.yield("Command", command,
+ arg[ 1], arg[ 2], arg[ 3], arg[ 4], arg[ 5], arg[ 6], arg[ 7], arg[ 8],
+ arg[ 9], arg[10], arg[11], arg[12], arg[13], arg[14], arg[15], arg[16],
+ arg[17], arg[18], arg[19], arg[20], arg[21], arg[22], arg[23], arg[24],
+ arg[25], arg[26], arg[27], arg[28], arg[29], arg[30], arg[31], arg[32])
+end