I am following an example I found where the agent sends data to the device like so: device.send("settings", { a = fid, b = fap, c = isclick, d = dnb});
and the device reads them like: agent.on("settings",function(v){ feedid = v.a; apikey = v.b; isclick = v.c.tointeger(); dnbase <- v.d.tointeger(); });
My question is can I create this part { a = fid, b = fap, c = isclick, d = dnb} dynamically? Then I could make the first value sent the number of values to follow so I know on the device side how many variables to read…
//device code:
agent.on(“settings”, function(data) {
// iterate through each value and do something
foreach(key, value in data) {
server.log(key + ": " + value);
}
}`