Logic Machine Forum
get data from table, dynamic - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: get data from table, dynamic (/showthread.php?tid=2844)



get data from table, dynamic - gjniewenhuijse - 16.09.2020

i have a table and i want to use this data, like:
Code:
dev =
{
   [21] = {value='10/1/1',battery='10/1/2'},
   [24] = {value='15/1/1'}
}
log(dev[21].value)

But from my others system i received the following:
id = 21
value = true
type = value or battery

how to use type (value or battery) as input? something like:
Code:
dev =
{
   [21] = {value='10/1/1',battery='10/1/2'},
   [24] = {value='15/1/1'}
}

type = 'value'
log(dev[21].type)
But this example doesn't work.


RE: get data from table, dynamic - admin - 16.09.2020

Code:
dev =
{
   [21] = {value='10/1/1',battery='10/1/2'},
   [24] = {value='15/1/1'}
}

type = 'value'
log(dev[21][type])



RE: get data from table, dynamic - gjniewenhuijse - 16.09.2020

(16.09.2020, 09:47)admin Wrote:
Code:
dev =
{
   [21] = {value='10/1/1',battery='10/1/2'},
   [24] = {value='15/1/1'}
}

type = 'value'
log(dev[21][type])
yeahh, thanks