This code, when run in the Lua TestCode window, will check all the scene Lua:
local json = require "dkjson"
for i,s in pairs (luup.scenes) do
print (i, s.description)
local _,j = luup.inet.wget ("127.0.0.1:3480/data_request?id=scene&action=list&scene=" .. i)
local sc = json.decode (j)
if sc and sc.lua then
local ok, err = loadstring (sc.lua, "scene_code_test")
if ok then print ('',"ok") else print ('', err) end
end
end
In order to see the printed output from this, you’d need to be running with AltUI. On my development machine this gives output like:
1 toggle table
ok
2 toggle bedside
ok
3 Timer Test
ok
6 Tuesday
ok
7 Monday
ok
8 Wednesday
ok
9 Weekday
ok
10 December
ok
11 Sunset
ok
12 Sunrise
ok
13 Weekend
ok
14 Delayed Actions
ok
If there was a syntax error, the ‘ok’ would be replaced by an appropriate error message.
Note: that this DOESN’T check the trigger Lua code, but could easily be modified to do so.