Skip to content

Object Variables

Name Input Params Return Data Description
resiot_getvarnum String Float Get the value of the variable VName as a Float
resiot_getvarstr String String Get the value of the variable VName as a String
resiot_getvarlastsetdate String Integer Get the last set date (in seconds) of the variable VName
resiot_setvarnum String, Float Boolean Set the variable VName with the Float Value
resiot_setvarstr String, String Boolean Set the variable VName with the String Value
resiot_setvarnumwdesc String, Float, String Boolean Set the variable VName with the Float Value and Description
resiot_setvarstrwdesc String, String, String Boolean Set the variable VName with the String Value and Description
resiot_map_add String, String, String Boolean Insert a variable into a map VName under the key Index
resiot_map_count String Integer Return the numbers of variables in the map VName
resiot_map_get String, String String Return the variable of the map VName that is stored under the key Index
resiot_map_edit String, String, String Boolean Modify a variable in the map VName that is stored under the key Index with the new Value
resiot_map_remove String, String Boolean Remove a variable from the map VName that is stored under the key Index
resiot_map_reset String Boolean Empty a VName map
resiot_map_exists String, String Boolean Check if the record VName of the map contains a value matched with Key
resiot_map_marshal String String, String Output the variable of type map as a valid Json string
resiot_deletevar String String Delete the variable VName

resiot_getvarnum(String)

Get the value of the variable VName as a Float.
Example
Value = resiot_getvarnum(VName)
Input Parameters
 - VName (String): * The name of the variable.
Returns
 - Value (Float): * The function returns the content of the variable VName as a Float if possible.

VName = "Age"                   -- The name of the variable
Value = resiot_getvarnum(VName)
resiot_debug(Value)
-- 
-- Result Example:
-- 
-- Value = 33
-- 

Return to index


resiot_getvarstr(String)

Get the value of the variable VName as a String.
Example
Value = resiot_getvarstr(VName)
Input Parameters
 - VName (String): * The name of the variable.
Returns
 - Value (String): * The function returns the content of the variable VName as a String if possible.

VName = "Hello"                 -- The name of the variable
Value = resiot_getvarstr(VName)
resiot_debug(Value)
-- 
-- Result Example:
-- 
-- Value = "World"
-- 

Return to index


resiot_getvarlastsetdate(String)

Get the last set date (in seconds) of the variable VName.
Example
Date = resiot_getvarlastsetdate(VName)
Input Parameters
 - VName (String): * The name of the variable.
Returns
 - Date (Integer): * The function returns the date of last set of the variable VName.

VName = "Hello"                         -- The name of the variable
Date = resiot_getvarlastsetdate(VName)
resiot_debug(Date)
-- 
-- Result Example:
-- 
-- Date = 1.507707803e+09 = 1507707803 seconds = October 11, 2017 - 7:43:23
-- 

Return to index


resiot_setvarnum(String, Float)

Set the variable VName with the Float Value.
If the variable VName doesn't exist, than it will be created.
Example
AllWorked = resiot_setvarnum(VName, Value)
Input Parameters
 - VName (String): * The name of the variable.
 - Value (Float): * The value for the variable.

Returns
 - AllWorked (Boolean): * The functions returns true if the assignment worked. *

Value = 3.5                                 -- The value for the variable
VName = "Age"                               -- The name of the variable
AllWorked = resiot_setvarnum(VName, Value)
resiot_debug(AllWorked)
-- 
-- If there aren't any errors:
-- 
-- AllWorked = true
-- The variable "Age" is now set to 3.5 
-- 
-- Else:
-- 
-- AllWorked = false
-- 

Return to index


resiot_setvarstr(String, String)

Set the variable VName with the String Value.
If the variable VName doesn't exist, than it will be created.
Example
AllWorked = resiot_setvarstr(VName, Value)
Input Parameters
 - VName (String): * The variable name.
 - Value (String): * The value for the variable.

Returns
 - AllWorked (Boolean): * The functions returns true if the assignment worked. *

VName = "Hello"                             -- The variable name
Value = "World!"                            -- The value for the variable
AllWorked = resiot_setvarstr(VName, Value)
resiot_debug(AllWorked)
-- 
-- If there aren't any errors:
-- 
-- AllWorked = true
-- The variable "Hello" is now set to "World!" 
-- 
-- Else:
-- 
-- AllWorked = false
-- 

Return to index


resiot_setvarnumwdesc(String, Float, String)

Set the variable VName and Description with the Float Value.
If the variable VName doesn't exist, than it will be created.
Example
AllWorked = resiot_setvarnumwdesc(VName, Value, Desc)
Input Parameters
 - VName (String): * The variable name.
 - Value (Float): * The value for the variable.

 - Value (String): * The description for the variable.
Returns
 - AllWorked (Boolean): * The functions returns true if the assignment worked.

Value = 3.5                                 -- The value for the variable
VName = "Age"                               -- The variable name
Desc = "Description"                        -- The variable description
AllWorked = resiot_setvarnumwdesc(VName, Value, Desc)
resiot_debug(AllWorked)
-- 
-- If there aren't any errors:
-- 
-- AllWorked = true
-- The variable "Age" is now set to "3.5" 
-- 
-- Else:
-- 
-- AllWorked = false
-- 

Return to index


resiot_setvarstrwdesc(String, String, String)

Set the variable VName and Description with the String Value.
If the variable VName doesn't exist, than it will be created.
Example
AllWorked = resiot_setvarstrwdesc(VName, Value, Desc)
Input Parameters
 - VName (String): * The variable name.
 - Value (String): * The value for the variable.

 - Desc (String): * The description for the variable.
Returns
 - AllWorked (Boolean): * The functions returns true if the assignment worked.

VName = "Hello"                             -- The variable name
Value = "World!"                            -- The value for the variable
Desc = "Description"                        -- The variable description
AllWorked = resiot_setvarstr(VName, Value, Desc)
resiot_debug(AllWorked)
-- 
-- If there aren't any errors:
-- 
-- AllWorked = true
-- The variable "Hello" is now set to "World!" 
-- 
-- Else:
-- 
-- AllWorked = false
-- 

Return to index


resiot_map_add(String, String, String)

Insert a variable into a map VName under the key Index.
The new map will be returned as result.
Example
AllWorked = resiot_map_add(VName, Index, Value)
Input Parameters
 - VName (String): * The name of the map.
 - Index (String): * The key in which the value is stored.

 - Value (String): * The value inserted into the map.
Returns
 - AllWorked (Boolean): * "true" if the operation has been successful, and "false" in the other case.

VName = "cost"                      -- The name of the map
Index = "sunglasses"                -- The key in which the value is stored
Value = "$ 13,00"                   -- The value inserted into the map
AllWorked = resiot_map_add(VName, Index, Value)
resiot_debug(AllWorked)
-- 
-- If there aren't any errors:
-- 
-- AllWorked = true
-- The map "cost" now have a new index "sunglasses" with value "$ 13,00"
-- 
-- Else:
-- 
-- AllWorked = false
-- 

Return to index


resiot_map_count(String)

Return the numbers of variables in the map VName.
Example
Count = resiot_map_count(VName)
Input Parameters
 - VName (String): * The name of the map.
Returns
 - Count (Integer): * The number of variables that are in the map VName.

VName = "cost"                  -- The name of the map
Count = resiot_map_count(VName)
resiot_debug(Count)
-- 
-- Result Example:
-- 
-- Count = 1
-- 

Return to index


resiot_map_get(String, String)

Return the variable of the map VName that is stored under the key Index.
Example
Variable = resiot_map_get(VName, Index)
Input Parameters
 - VName (String): * The name of the map.
 - Index (String): * The key in which the value you need is stored.

Returns
 - Variable (String): * The variable of the map VName under the Index key. *

VName = "cost"                  -- The name of the map
Index = "sunglasses"            -- The key in which the value you need is stored
Variable = resiot_map_get(VName, Index)
resiot_debug(Variable)
-- 
-- Result Example:
-- 
-- Variable = "$ 13,00"
-- 

Return to index


resiot_map_edit(String, String, String)

Modify a variable in the map VName that is stored under the key Index with the new Value.
Example
AllWorked = resiot_map_edit(VName, Index, Value)
Input Parameters
 - VName (String): * The name of the map.
 - Index (String): * The key in which the value is modified.

 - Value (String): * The new value.
Returns
 - AllWorked (Boolean): * "true" if the operation has been successful, and "false" in the other case.

VName = "cost"              -- The name of the map
Index = "sunglasses"        -- The key in which the value is modified
Value = "$ 20,00"           -- The new value
AllWorked = resiot_map_edit(VName, Index, Value)
resiot_debug(AllWorked)
-- 
-- If there aren't any errors:
-- 
-- AllWorked = true
-- The index "sunglasses" in the map "cost" has been updated to "$ 20,00"
-- 
-- Else:
-- 
-- AllWorked = false
-- 

Return to index


resiot_map_remove (String, String)

Remove a variable from the map VName that is stored under the key Index.
Example
AllWorked = resiot_map_remove(VName, Index)
Input Parameters
 - VName (String): * The name of the map.
 - Index (String): * The key in which the value is removed.

Returns
 - AllWorked (Boolean): * "true" if the operation has been successful, and "false" in the other case. *

VName = "cost"          -- The name of the map
Index = "sunglasses"    -- The key in which the value is removed
AllWorked = resiot_map_remove(VName, Index)
resiot_debug(AllWorked)
-- 
-- If there aren't any errors:
-- 
-- AllWorked = true
-- The index "sunglasses" in the map "cost" has been deleted
-- 
-- Else:
-- 
-- AllWorked = false
-- 

Return to index


resiot_map_reset(String)

Empty the VName map
Example
AllWorked = resiot_map_reset(VName)
Input Parameters
 - VName (String): * The name of the map.
Returns
 - AllWorked (Boolean): * "true" if the operation has been successful, and "false" in the other case.

VName = "cost"          -- The name of the map
AllWorked = resiot_map_reset(VName)
resiot_debug(AllWorked)
-- 
-- If there aren't any errors:
-- 
-- AllWorked = true
-- The map "cost" has been reset
-- 
-- Else:
-- 
-- AllWorked = false
-- 

Return to index


resiot_map_exists(String, String)

Check if in the map VName contains a variable in the key Index.
Example
AllWorked = resiot_map_exists(VName, Index)
Input Parameters
 - VName (String): * The name of the map.
 - Index (String): * The key of the designated cell.

Returns
 - AllWorked (Boolean): * "true" if the operation has been successful, and "false" in the other case. *

VName = "cost"              -- The name of the map
Index = "sunglasses"        -- The key of the designated cell
AllWorked = resiot_map_exists(VName, Index)
resiot_debug(AllWorked)
-- 
-- If there aren't any errors:
-- 
-- AllWorked = true
-- The index "sunglasses" exists in the map "cost"
-- 
-- Else:
-- 
-- AllWorked = false
-- 

Return to index


resiot_map_marshal(String)

Output the variable of type map as a valid Json string.
Example
AllWorked, err = resiot_map_marshal(VName)
Input Parameters
 - VName (String): * The name of the map.
Returns
 - AllWorked(String): * The map in a Json valid string format.

 - err(String): * If there is an error during the marshal, it will be saved in this variable. *

VName = "cars"              -- The name of the map
resiot_map_reset(VName)
resiot_map_add(VName, "Bmw", "M4")
resiot_map_add(VName, "Audi", "A3")
resiot_map_add(VName, "Nissan", "Micra")
resiot_map_add(VName, "Fiat", "Punto")
AllWorked, err = resiot_map_marshal(VName)
if err ~= "" then
    -- error 
    resiot_debug(err)
else
    -- value read correctly
    resiot_debug(AllWorked)
end

Return to index


resiot_deletevar(String)

Delete the variable VName.
Example
err = resiot_deletevar(VName)
Input Parameters
 - VName (String): * The name of the Variable.
Returns
 - err(String): * If there is an error during the delete, it will be saved in this variable.

VName = "cars"              -- The name of the Variable
err = resiot_deletevar(VName)
if err ~= "" then
    -- error 
    resiot_debug(err)
end

Return to index