[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Table element addressing syntax
- From: "Curt Carpenter" <curtc@...>
- Date: Mon, 26 Nov 2001 23:26:49 -0800
Is there any way to reference a nested element of a table given a string
reference to it? That is, given some simple data like this:
foo = {a=1, b=2, c={d=3}}
Could you have a function like this (I know this function doesn't work):
function GetElement(table, field)
return table[field]
end
such that with the above data GetElement(foo, "c.d") returns 3?
Thanks,
Curt