Page 2 of 2

Re: Saving/Loading big map table

Posted: Tue May 22, 2018 3:29 pm
by LXDominik
grump wrote: Tue May 22, 2018 2:37 pm Yes. Although using a table of tables is not the most efficient way to do this, it will work fine.

For maximum effciency use a plain, one-dimensional array and index like this:

Code: Select all

local map = {}
for y = 0, 2047 do
    for x = 1, 8192 do
        map[y * 8192 + x] = blob:readU8()
    end
end
That's not Blob related though, just general performance advice. You'll get better cache hit rates when you do it like this.
Thx for the tip, i will try to rewrite my code for it to work with 1d array