I'd like to implement some Lua data structure to achieve the following syntax:
units-> returns a table of units.units[0]-> returns a number.units[0].properties-> returns a table of properties.units[0].properties[0]-> return the property of units[0], which is also a number.
The first 2 steps are trivial given a number indexed table. But can I achieve all 4 requirements at the same time?
I was thinking about creating units with customized __index metamethod. Is it the right direction?