summaryrefslogtreecommitdiff
path: root/init.old.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.old.lua')
-rw-r--r--init.old.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/init.old.lua b/init.old.lua
new file mode 100644
index 0000000..34c744e
--- /dev/null
+++ b/init.old.lua
@@ -0,0 +1,30 @@
+-- Compile server code and remove original .lua files.
+-- This only happens the first time after the .lua files are uploaded.
+local compileAndRemoveIfNeeded = function(f)
+ if file.open(f) then
+ file.close()
+ print('Compiling:', f)
+ node.compile(f)
+ file.remove(f)
+ collectgarbage()
+ end
+end
+
+local serverFiles = {
+ 'microwire.lua',
+ 'lmx2487lib.lua',
+ 'binaryLib.lua',
+ 'freq2lmx2487settings.lua'
+}
+--for i, f in ipairs(serverFiles) do compileAndRemoveIfNeeded(f) end
+
+compileAndRemoveIfNeeded = nil
+serverFiles = nil
+collectgarbage()
+
+
+-- some diagnostic
+print('chip: ',node.chipid())
+print('heap: ',node.heap())
+
+dofile("main.lua")