Example of OutputPort("all", "array")

local out_3 = OutputPort(“all 3”,“array”);

the 3 parameters are channel, temperature, humidity

local channel=1;
local tempt=25;
local humidity= 75;

I output them to another IMP, which shows (array: 0x0x20014f00)

either with
out_3.set ([channel, temp, humidity]);
imp.configure(“channel, tempt, humidity”, [], [out_3]);

or declare all output as an array

local tarray=[channel,tempt,humidity];
out_3.set (tarray);
imp.configure(“channel, tempt, humidity”, [], [out_3]);

My questions are

  1. What is (array: 0x0x20014f00) mean, how to decode it
  2. How to send an array of 3 values to the output port
    ( I can set up 3 separate ports and output each of them to a separate receiver IMP , or combine the 3 values and output them as a string to only 1 receiver IMP. I prefer to have 3 separate numeric values instead of 1 combined string)

Thanks in advance

If you try to print an array, squirrel doesn’t know how to flatten it to something printable, hence you just see the array text.

You should have no problems sending the array to another imp. The other imp will receive an object that you need to index to retrieve the values, eg:

class x extends InputPort {
function set(a) {
server.log("rx “+a[0]+” “+a[1]+” "+a[2]);
}
}

If you want 3 output ports, then you just create 3 outputports and list them in the imp.configure output array, eg imp.configure(“channel,temp,humid”, [], [chan,temp,humid]);