blob: 1756628ccfd857a8a9973bed6f25dcfc70732a81 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
--- Somewhat safely loads "run.lua" module into a global variable RUN. Loaded module itself should be a function. If
--- everything seems fine, true is returned.
function init ()
wifi.setmode(wifi.NULLMODE, false)
local l, r = pcall(require, "run")
if not l then
print("run.lua not found")
return
end
RUN = r
l, r = node.bootreason()
if l == 2 and (r == 2 or r == 4) then
print("Most likely an exception restarted last boot, run.lua loaded into RUN and left as is")
return
end
return true
end
if init() then
RUN()
end
|