Page 1 of 1

'global' functions? / user library?

Posted: Friday 04 January 2019 20:06
by renerene
There are some functions that I use in several dzVents scripts. At the moment this is a copy/paste thing.
Question: is it possible to call functions 'outside' the current script and create a central library?

Re: 'global' functions? / user library?

Posted: Friday 04 January 2019 20:12
by jvdz
I use this in regular LUA scripts to include a file with my standard functions:

Code: Select all

dofile("/home/pi/domoticz/scripts/lua/general_functions.lua")
Assume it works the same in DzVents as they are LUA.

Jos

Re: 'global' functions? / user library?

Posted: Friday 04 January 2019 20:31
by waaren
jvdz wrote: Friday 04 January 2019 20:12 I use this in regular LUA scripts to include a file with my standard functions:

Code: Select all

dofile("/home/pi/domoticz/scripts/lua/general_functions.lua")
Assume it works the same in DzVents as they are LUA.

Jos
Yes that will work in dzVents but on top of that, dzVents has a kind of builtin mechanism for this; called helper functions

Re: 'global' functions? / user library?

Posted: Friday 04 January 2019 21:41
by renerene
Yes that will work in dzVents but on top of that, dzVents has a kind of builtin mechanism for this; called helper functions
Perfect!
Thank you