Logic Machine Forum
Scripting variable - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Scripting variable (/showthread.php?tid=2752)



Scripting variable - Frank68 - 27.07.2020

Hi

the variable used inside the script is GLOBAL ?

is possible use ALM1 in script 1 and ALM1 in script 2


when i try to make some sum I have this error  
attempt to perform arithmetic on global 'ALM1' (a nil value)

But I make an addiction ALM1+ALM2 , if possible I have ALM1=0 and ALM2 =0

Thank's in adavantage


RE: Scripting variable - Daniel - 27.07.2020

Variables in script are local. To use values between scripts you can use object or save data to storage.


RE: Scripting variable - Leo681 - 18.03.2022

(27.07.2020, 15:02)Daniel Wrote: Variables in script are local. To use values between scripts you can use object or save data to storage.

Hello,

Wich option use less resourses? is it safe to persistently write to data storage?

Thanks in advance

Thank


RE: Scripting variable - Erwin van der Zwart - 19.03.2022

Difference is that objects can only hold a single value, storage can hold tables so depending on your task you might need to use storage.

From performance you need to use virtual objects otherwise the values are processed for sending to the KNX interfaces and that uses recourses. 

I think storage or virtual objects are using the same amount of resources but admin might correct me ? 

The biggest difference is that you can see the objects and the values in the objects tab or even on your visu if needed, storage is only visible by using log() or the storage viewer app. 

Both methods are running in RAM and are stored on SD by the save interval, so both are save to use with persistent / high speed writing.


RE: Scripting variable - admin - 21.03.2022

Which one to use depends on the task. Objects can hold up to 250 bytes of data while storage can hold a lot more and you can put complex data like Lua tables there.
Virtual objects can be added into visualization to have some user-configurable properties (like e-mail address for reports etc) while this is not possible directly with storage.