blob: 34c744e2f458448f7be309d3ba1b9271498ee6f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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")
|