This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

get data from table, dynamic
#1
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.
Reply
#2
Code:
dev =
{
   [21] = {value='10/1/1',battery='10/1/2'},
   [24] = {value='15/1/1'}
}

type = 'value'
log(dev[21][type])
Reply
#3
(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
Reply


Forum Jump: