57
•
The following examples shows the basic syntax of
storage.get
. Assuming that key value
was not found, first call will return
nil
while second call will return number
0
which was
specified as a default value.
1.
result
=
storage.get
(
'my_stored_value_3'
)
-- returns nil if value is not found
2.
result
=
storage.get
(
'my_stored_value_3'
,
0
)
-- returns 0 if value is not found
•
When storing tables make sure to check the returned result type. Assume we have created
a storage item with key
test_object_data
.
1.
objectdata
={}
2.
objectdata.temperature
=
23.1
3.
objectdata.scene
=
'default'
4.
result
=
storage.set
(
'test_object_data'
, objectdata
)
-- store objectdata variable as
'test_object_data'
•
Now we are retrieving data from storage. Data type is checked for correctness.
1.
objectdata
=
storage.get
(
'test_object_data'
)
2.
if type
(
objectdata
)==
'table'
then
3.
if
objectdata.temperature
>
24
then
4.
-- do something if temperature level is too high
5.
end
6.
end
1.2.13.
Alert function
alert(message, [var1, [var2, [var3]]])
Stores alert message and current system time in the main database. All alerts are accessible in the
"Alerts" module. This function behaves exactly as Lua
string.format
.
Example
1.
temperature
=
25.3
2.
if
temperature
>
24
then
3.
-- resulting message: 'Temperature levels are too high: 25.3'
4.
alert
(
'Temperature level is too high: %.1f'
, temperature
)
5.
end
1.2.14.
Log function
log(var1, [var2, [var3, ...]])
Converts variables to human-readable form and stores them in the main database. All items are
accessible in the "Logs" module.
Summary of Contents for LogicMachine3 Re:actor
Page 10: ...10 Terminal connection schemes KNX TP...
Page 12: ...12 24V power supply...
Page 13: ...13 Analog inputs e g reed contact...
Page 14: ...14 Analog inputs 0 10V...
Page 15: ...15 Digital output...
Page 16: ...16 Resistive sensor input...
Page 17: ...17 Analog output...
Page 26: ...26 Make sure that bus status is Online press button in ETS...
Page 35: ...35 o Then minimize side bar by pressing on left arrow icon to make the map more visible...
Page 83: ...83 66 if err then 67 alert FTP upload failed s err 68 end...
Page 107: ...107...
Page 108: ...108 1 14 Help Documentation for scripting syntaxes is displayed in Help tab...
Page 126: ...126 Datapoints can be shown also in a way of table which can be later exported as CSV file...
Page 141: ...141...