Skip to content

Variables

Variables are server-level variables that can be used while coding Scenes to store data.

Where you can create a new Variable

Find

Click on Add New button.

Find

The required fields are Name and Type.
The most common Types are Single String and Single Numeric.

Name
Type

For retrieve and set values we use: resiot_getvarstr, resiot_setvarstr

Main Scene:

    VName = "VarTest"
    Value = "Hello World!"
    worked = resiot_setvarstr(VName, Value)

    if worked then
        VarValue = resiot_getvarstr(VName)
        resiot_runscene("736365313832")
    else
        resiot_globaldebug("The value does not exists")
    end

Second Scene:

    Origin = resiot_startfrom()
    if Origin == "Scene" then
        Value = resiot_getvarstr("VarTest")
        resiot_globaldebug(Value)
        worked = resiot_setvarstr("VarTest", "Good Night!")
        if worked then
            resiot_globaldebug("VarTest")
        end
    end

Result:

Result

Note

If VarTest was a Single Numeric we should have used:
resiot_getvarnum instead of resiot_getvarstr
resiot_setvarnum instead of resiot_setvarstr