I want to parse thru chunks of the map, but not in one single for loop like this :
Code: Select all
for chunk in surf.get_chunks() do
(...)
So I suppose that I have to call this iterator one by one, keeping memory of where I am in global, but I cannot figure out how to write it...
I tried this but it does not work... (I am not very familiar with LUA deep programming)
Code: Select all
if global.refresh_chunk == nil then
global.refresh_chunks = surf.get_chunks()
end
global.refresh_chunk = global.refresh_chunks()
if global.refresh_chunk ~= nil then
local chunk = global.refresh_chunk
local a = {{chunk.x * 32, chunk.y * 32}, {chunk.x * 32 + 32, chunk.y * 32 + 32}}