This must be embarrassingly easy, but I can't find the solution: I have a text file with data in this form:
| 1 | 1 | A | X |
| | 2 | A | Z |
| | | B | Y |
I would like to process this data with Lua, so I need to have it in a structured (nested) table like this (I hope the indentation comes out right):
t = {
['1'] =
{
['1'] =
{
{
{ ['A'] = 'X' },
},
},
['2'] =
{
{
{ ['A'] = 'Z' },
{ ['B'] = 'Y' },
},
},
},
}
But I can't figure out how to go from A to B. The structure is already kind of there, but how can I read it into Lua?