Skip to content

Scene run Scene

A Scene may run another Scene with the function resiot_runscene.
The first param must be the ID Hex of the second Scene while the other params may be unlimited values (Integer, String, Boolean). The first returnet value is a boolean that describe if all went good while the second one describe the error in case the first is false.

The Main Scene:

    IDHex = "69643d31"
    Param1 = 0
    Param2 = "Index 1"
    Param3 = false
    Result, err = resiot_runscene(IDHex, Param1, Param2, Param3)
    if Result == false then
        resiot_globaldebug(err)
    end

The Second Scene:

    Origin = resiot_startfrom()
    if Origin == "Scene" then
        -- Count = 3
        -- (0, "Index 1", false)
        Count = resiot_getparamcount()
        -- i = 0 --> 0
        -- i = 1 --> "Index 1"
        -- i = 2 --> false
        for i=0,Count-1,1
        do
            param = resiot_getparam(i)
            resiot_globaldebug(param)
        end
    end

Result:

Result

resiot_getparamcount: This function get the total count of the input Parameters. In this case we have 3 Parameters.
resiot_getparam: Get the value at given position. In this case:
- Value at index 0: 0
- Value at index 1: "Index 1"
- Value at index 2: false

Note

The two Scenes are asynchronous; it means that the first Scene doesn't wait for the second one to finish for proceding.