Saving/Loading big map table

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
LXDominik
Prole
Posts: 26
Joined: Wed Oct 01, 2014 9:05 am

Re: Saving/Loading big map table

Post 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
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 89 guests