Hi I need to create a table in lua with each entry(record) can be represented by unique id
table[p1d2].seq={0,1,2,3} table[p1d2].days={'sun','mon','wed'}
table[p2d2].seq={0,1,2,3,4} table[p2d2].days={'fri','sat','tue'}
print(table.concat(table[p1d2].seq))==> 0123
like that i want to insert and access please help me in solving this riddle
I'm not sure to understand what you're asking for, since tables in Lua natively handle string indexes, for example the following snippet:
prints
1...if that is not what you're asking, could you please try to explain more precisely what behavior you want?And if that was your question, a code like this one should work (I defined a
Thingclass since I see you seem to use a class withseqanddaysfields, but I guess you already have something of the kind in your code, so I only left it for informational purposes).