@Toby - that is great - it works as it should and my small test with the loading time is ten times faster then using Json. I really appreciate your help.
Since I am having you on the line and you are a great guy - can you maybe help me with this last thing, so that I don’t have to go through all my old code to change it…
As I told you, I am building up an lua table from the data. The table I am having now, is not by the same format as it was when I was using JSON. Well, I can go over all my code but that would be a lot of work.
Before I could address my array like this:
print(tmp_data[i].Name)
but now it doesn’t seems to work… I can’t access the “param” as I used to.
I am building up my array like this:
local table = {}
--Reading and splitting in all rows from the file
table = string.split( parseData("animaldata/text.txt"),"|")
--Go through all lines and build the array
for i = 1,#table, 1 do
s = table[i]
animArr[i] = {}
for k, v in string.gmatch(table[i], "([%w]+)=([%w%p][^,]\*)") do
animArr[i][k] = v
end
end
Thanks, Joakim [import]uid: 81188 topic_id: 25780 reply_id: 104248[/import]