04.08.2020, 21:59
(This post was last modified: 05.08.2020, 10:34 by Erwin van der Zwart.)
Hi,
Try this (enclose what you want in [ ... ] ):
But be carefull with this methode, your address 32/1/21 can hold a duplicate value and you might overwrite another table
Sample:
BR,
Erwin
Try this (enclose what you want in [ ... ] ):
Code:
Nombre_modo = grp.getvalue('32/1/21')
encendido_clima = grp.getvalue('32/1/22')
temperatura_clima = grp.getvalue('32/1/23')
velocidad_clima = grp.getvalue('32/1/24')
mytable = {}
mytable[Nombre_modo] = {}
mytable[Nombre_modo].encendido = encendido_clima
mytable[Nombre_modo]['temperatura'] = temperatura_clima
mytable[Nombre_modo]['velocidad'] = velocidad_clima
mytable.mysecondtable = {}
mytable.mysecondtable.encendido = encendido_clima
mytable.mysecondtable.temperatura = temperatura_clima
mytable.mysecondtable.velocidad = velocidad_clima
log(mytable)
Sample:
Code:
Nombre_modo = grp.getvalue('32/1/21') -- lets assume this holds value 'Test'
encendido = grp.getvalue('32/1/22') -- lets assume this also holds value 'Test'
mytable = {}
mytable[Nombre_modo] = {} -- Add a new empty sub tabel called 'Test'
mytable[Nombre_modo].value = 100 -- Add a new entry inside table 'Test' -> value with value 100
mytable[encendido] = {} -- This wil overwrite previous Nombre_modo as this is 'Test' and we add now a empty table {} 'Test'
-- so value = 100 is deleted
log(mytable)
Erwin