[Solved]Luup code in scenes failing to run

Hi,
OK today my Luup code in my scenes is failing to run
errors

08	12/28/19 14:13:25.268	JobHandler_LuaUPnP::HandleActionRequest argument SceneNum=45 <0x74447520>
08	12/28/19 14:13:25.268	JobHandler_LuaUPnP::HandleActionRequest argument rand=0.09390159472028337 <0x74447520>
08	12/28/19 14:13:25.268	Scene::RunScene running 45 clipboard <0x74447520>
01	12/28/19 14:13:25.269	LuaInterface::CallFunction_Scene Scene  45 failed attempt to call a nil value <0x74447520>

I have restarted the box but no effect. All code runs from app-developer-run test Luup.
Anyone seen this before
[Solved]Luup code in scenes failing to run - #6 by rigpapa - Scene Scripting - Ezlo Community

Maybe post the code from scene 45?

ok i will, but it’s not just scene 45 its all scenes with code. many of which havebeen working for a weeks.

luup.call_action("urn:dlna-org:serviceId:DLNAMediaController1", "Say", {Text="toggled clipboard", Volume=50, GroupZones="Lounge"}, 122
) 

or from another scene

local http = require("socket.http")
  http.TIMEOUT = 5
  result, status = http.request("https://llamalab.com/automate/cloud/message", "secret=1.hwlkhfwljhflhfhfwwGFhI=&to=thetest@gmail.com&device=&priority=normal&payload=launch;org.mozilla.firefox|org.mozilla.gecko.LauncherActivity|android.intent.action.VIEW|192.168.1.1;cctv;")   

Startup Lua empty, or do you have stuff there as well?

Start up is empty.

OK. I would do a reload on the box, and then examine the LuaUPnP log file’s logged info at startup… when Luup starts up, it puts startup Lua and all the scene Luas into one big source code block and loads (the Lua version of “compiles”) it… if any of them contains a syntax error, all of them will be empty and broken. And that will cause a nil reference when you attempt to run the scene (it’s calling an undefined function that is the wrapper for that scene’s Lua, which doesn’t exist because of the error). That brokenness will be logged, if only very subtly, in that log file during startup.

To access the log: http://your-vera-local-ip/cgi-bin/cmh/log.sh?Device=LuaUPnP

The other thing you could do is install my LuaView plugin, which brings all scene and startup Lua into one interface, and uses a syntax-checking editor that will flag problems for you. ALTUI also uses that same editor, so if you use ALTUI, you just need to go look at all your scenes’ Lua.

1 Like

I looked earlier and there was a block of scene after a reload.

So i will have to go through all my scenes and check syntax.

OK. Watch out for those quotes… copy-paste of incorrectly formatted code posts in these forums, or through some editors on mobile devices and desktops, will corrupt the “plain” quotes into “pretty” quotes. No good. Since your code is properly-formatted above (well done), I assume you’ve run into this at least once.

Check that the code ends with a carriage return.

I usually put a blank comment line at the end, thus:

--

However, if this has recently started, I guess not.

Cheers rigpapa, i had pasted a json and not converted it to webform. Now i know that 1 syntax error corrupts all code i will be more carefull.

1 Like

rigpapa, yes i have some knowledge of coding when i was much younger i did do some html, php and javascript, but thats not my living.
I am currently moving all my plugins and stuff to node-red and hav installed a local server on an old android tv box. Seems to be very smooth.