aboutsummaryrefslogtreecommitdiff
path: root/diller/init.lua
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-11-19 19:33:05 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-11-19 19:33:05 +0100
commit937040944ffdf7819b7ce7bee23a3d346718c0e4 (patch)
treedb408e56ae414db637b1e58717d99bceda2cfcd5 /diller/init.lua
parent46f5784e3acb277aab44217e2521625ffe043d35 (diff)
downloadesp-playground-master.tar.gz
esp-playground-master.tar.bz2
esp-playground-master.tar.xz
esp-playground-master.zip
Major refactoring, splitting stuff into separate files.HEADmaster
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