15.03.2021, 13:02
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