EasyManuals Logo

Embedded Systems LogiMachine5 Power User Manual

Embedded Systems LogiMachine5 Power
254 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #75 background imageLoading...
Page #75 background image
75
1.
testfn=function(t)
2.
return t * t
3.
end
4.
result =storage.set('my_stored_value_2', testfn)-- this will result in an error
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
6.1.15. 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

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Embedded Systems LogiMachine5 Power and is the answer not in the manual?

Embedded Systems LogiMachine5 Power Specifications

General IconGeneral
BrandEmbedded Systems
ModelLogiMachine5 Power
CategoryController
LanguageEnglish