This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Scripting variable
#1
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
Reply
#2
Variables in script are local. To use values between scripts you can use object or save data to storage.
------------------------------
Ctrl+F5
Reply
#3
(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
Reply
#4
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.
Reply
#5
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.
Reply


Forum Jump: