Skip to content

Error when using tiles iterator #4

Description

@DominikStyp
cartographer = require 'externalLibs.cartographer.cartographer' -- if it's in subfolders
-- load a map
local map = cartographer.load 'map.lua'

function love.load()
	local layer = map:getLayer("layer1")
	local allTiles = layer:getTiles()
	for v in allTiles do
	      print(v)
	end

end
function love.update(dt)
	-- update animations
	map:update(dt)
end

function love.draw()
	-- draw the whole map
	map:draw()
end

This code doesn't work, despite that map is drawn on the screen, following error occurs when I try to iterate over tiles:

Error

externalLibs/cartographer/cartographer.lua:649: attempt to perform arithmetic on local 'i' (a nil value)


Traceback

externalLibs/cartographer/cartographer.lua:649: in function '(for generator)'
main.lua:8: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions