aboutsummaryrefslogtreecommitdiff
path: root/diller/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'diller/init.lua')
-rw-r--r--diller/init.lua60
1 files changed, 60 insertions, 0 deletions
diff --git a/diller/init.lua b/diller/init.lua
new file mode 100644
index 0000000..c842898
--- /dev/null
+++ b/diller/init.lua
@@ -0,0 +1,60 @@
+-- l = file.list(); for k,v in pairs(l) do print("name: "..k..", size: "..v) end
+function go()
+ compile = true
+ x = function(name)
+ compile = true
+ compiled = name:gsub('lua$','lc')
+ if compile then
+ local ok = file.open(name)
+ if not ok then
+ print('already compiled '..name)
+ return
+ end
+
+ print('Compiling '..name)
+ node.compile(name)
+
+ ok = file.open(compiled)
+ if ok then
+ print('success, removing '..name)
+ file.remove(name)
+ end
+ else
+ print('removing compiled version of '..name)
+ file.remove(compiled)
+ end
+ end
+ ext = 'lua'
+ if compile then
+ ext = 'lc'
+ end
+
+ x('main.lua')
+ x('cfg.lua')
+ x('on_cmd.lua')
+ x('inter.lua')
+ x('mq.lua')
+ x('property.lua')
+ x = nil
+
+ print("network");
+ print("wlan");
+ print("set-property id=temp-0 value=12.3 type=temperature name=Water");
+
+ print("heap.."..node.heap())
+ mq = require('mq')
+ print("heap.."..node.heap())
+ inter = require('inter')
+ print("heap.."..node.heap())
+ dofile('on_cmd.'..ext)
+ print("heap.."..node.heap())
+ dofile('cfg.'..ext)
+ print("heap.."..node.heap())
+ dofile('main.'..ext)
+ print("heap.."..node.heap())
+
+ -- leave no trace behind!
+ compile = nil
+ go = nil
+ main()
+end