[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: create nested table from string
- From: Markus Huber <pulse@...>
- Date: Mon, 5 Jul 2004 17:37:28 +0200 (BST)
How can be a nested table created from strings/data pairs like this?
<Strings> def. the table should be filled with <Data>
"Colour." "black"
"Colour.Markus." "blue"
"Colour.Markus." "yellow"
"Colour.Thomas" "green" -- note: without the last point
"Colour.Group.Heinz." "red"
So the result should be a table:
print(Colour[1]) --> "black"
print(Colour.Markus[1]) --> "blue"
print(Colour.Markus[2]) --> "yellow"
print(Colour.Thomas) --> "green"
print(Colour.Group.Heinz[1] --> "red"
Any solutions without using dostring()? I think a recursive function
call does the work and I will programm this later this day but possible
someone has an already running solution or any other good ideas.
--
Markus