15.03.2021, 13:04
(This post was last modified: 15.03.2021, 13:05 by gjniewenhuijse.)
(15.03.2021, 13:02)admin Wrote: Like this, and make sure that v is defined before devices:
Code:-- data get from webservice v = {hum=1, tst='abc'} log(v.hum, v.tst) -- devices devices = { {'9d', 'SENSOR', '8/4/5', v.hum}, {'9e', 'COMMON', '8/4/6', v.tst} } -- print some data from v, based on data in devices for k,k_items in pairs(devices) do -- log variable name log(k_items[4]) -- log the data in variable with name k_items[4], for example the data in v.hum or v.tst (1 or abc) end
No thats not possible, because my devices are defined before i get the data from the webservice.
Now i defined v hardcoded, but normally this thats comes from the web and is parsed.