I have been doing some basic scripting; if then statements in luup in vera scenes;
One thing that I find incredibly difficult is working and debugging with variables.
Sometimes I will have the code fail due to various different issues; and there is no way to know why things failed (at least I don’t know). I can search the /var/log/cmh/LuaUPnP.log file and get a little bit more information; but if I am writing code that calls a variable; something like:
I have no way of knowing what the variable “status5” that the system wrote back was… If this was a batch file; I could do something like “echo status5” and have it display the variables so I could know what I was working with… but I can’t seem to find a way to get this information. I’ve tried the “Develop app” section; where it says test luup code; but it just tells me if it failed or not… no details. (perhaps I am using this section wrong?)
How do you guys work with variables and debug? I’m starting to get into some more complex "if elseif else " statements with a lot more variables and it is becoming impossible to know which variable is coming back “nil” or otherwise different than expected.
Have you tried the print() function, as laid out in the Lua Programming Manual? Seems like it’s intended to send arguments directly to STD_IO, which in Vera’s case, I suspect is the log file. I don’t know how to view variables directly using luup, though. (For stuff like that, I strictly use Expressions in the Reactor plug-in, and let it handle everything.)
I indeed think that either ALTUI, Luaview or the old luatest plugin would help you a lot. I personally moved to ALTUI and used the code test feature extensively.
It is rather weird that UI7 offered a test lua code feature with no output or return fields.