I'm trying to create a complex database that can be filled from TXT files. I have a bit similar type of idea in my old set of RPG scripts, but there I used several different tables and many if-elses to fill each separately. This time I'm trying to save rows of code by filling the database with as few if-elses as possible.
First of all, I know how to create a table inside a table:
Table = {{"String1","String2"},{"String1","String2"}}
function main(e)
Prompt(Table[1][1])
end
However this doesn't seem to work:
Table = {{}}
function main(e)
Table[e][1] = "String1"
Prompt(Table[e][1])
end
The game thinks the table entry doesn't exist.
And if I do this:
Table = {{}} -- Same result happens with with Table = {}
function init(e)
Table[e] = {}
end
function main(e)
Table[e][1] = "String1"
Prompt(Table[e][1])
end
It gives no error message, but the game just freezes.
Is there something fundamentally wrong with my idea or do I just need to go through my code to look for typos? (The actual script is a bit more complicated than the one I typed here. Just want to make sure I'm doing the basic idea correctly before intense typo-search of the actual code...)