Page 1 of 1

Differences using LUA script in webinterface vs flat file

Posted: Monday 23 January 2017 17:15
by Bartb
Hi,

I have several LUA scripts running as files in the .../domoticz/scripts/ directory.
I also have one LUA script that I inserted via the web interface.
All works fine and in parallel.
The only difference I see is that scripts added to the .../domoticz/scripts/ directory are not visible in the web interface and visa versa.

Are there any other advantages/disadvantage for putting LUA scripts in the web interface, possibly in terms of speeds, flexibility, backing up, etc., that are worth knowing?

thanks!

Re: Differences using LUA script in webinterface vs flat file

Posted: Monday 23 January 2017 17:26
by Egregius
I believe file based scripts are executed before the database scripts (at least that was my finding several months ago).
So file based scripts are slightly faster, definnitely if there's only one. The more scripts the slower they get.
As for backup, I prefer files also because I backup my whole domoticz folder. Even when the database is completely corrupted I still have the scripts.
Another advantage that I can think of is that while you keep the script open in a editor you can use undo the revert recent changes.

Re: Differences using LUA script in webinterface vs flat file

Posted: Monday 23 January 2017 18:14
by lost
Egregius wrote:Another advantage that I can think of is that while you keep the script open in a editor you can use undo the revert recent changes.
That's right, but I wonder if there is a way to test without waiting for execution (every mn for a time script, once changed for a device)... Well, a way to trigger the Domoticz Lua interperter off line!

At the moment, I stick to python, only making the domoticz glue with Lua, for this reason (well, some heavy json results parsing, for instance; is usually easier in python too but sometimes I may have sticked to Lua if debug was easier)...

Re: Differences using LUA script in webinterface vs flat file

Posted: Monday 23 January 2017 19:38
by Egregius
I only use one lua script to pass the changed device to php, all the rest is done there.
You can always trigger the device by calling the json updatedevice command in a browser ;)