Bug in Map:getTileSetFromGID(gid) ?

This is all a little scary as I only understand a few percent of the Lime code, but I received the following error message after I added an object to the CollectibleItems tutorial code:

Runtime error ...s/franks/MySqwormy/CollectibleItemsIPad/lime-map.lua:574: attempt to compare string with nil stack traceback: [C]: ? ...s/franks/MySqwormy/CollectibleItemsIPad/lime-map.lua:574: in function 'getTileSetFromGID' ...ranks/MySqwormy/CollectibleItemsIPad/lime-object.lua:416: in function 'create' .../MySqwormy/CollectibleItemsIPad/lime-objectLayer.lua:531: in function 'create' ...s/franks/MySqwormy/CollectibleItemsIPad/lime-map.lua:1070: in function <...s><br>

The following change in lime-map.lua seems to fix it (the commented-out line is the original):
[lua]--------------------------------------------------------------------------------------------------------
----
---- @name: getTileImageFromGID
----
---- @description: Gets a Tile image from a GID.
----
---- @param: gid - The gid to use.
----
--------------------------------------------------------------------------------------------------------
function Map:getTileSetFromGID(gid)

local tileSet = nil

local nextTileSet = nil

for i=1, #self.tileSets, 1 do

if self.tileSets[i].firstgid < gid then

– nextTileSet = self.tileLayers[i + 1]
nextTileSet = self.tileSets[i + 1] – changed by FS

if nextTileSet then

if nextTileSet.firstgid > gid then
tileSet = self.tileSets[i]
end

else

tileSet = self.tileSets[i]

end

end

end

return tileSet
end[/lua]

Not sure if I made it “better”, but it seems to work again.
-Frank. [import]uid: 8093 topic_id: 6680 reply_id: 306680[/import] </…s>

Hey, no idea why I was originally getting a tile layer when I wanted a tileset so thankyou for fixing it for me :slight_smile: The fix will be put in to 2.8 [import]uid: 5833 topic_id: 6680 reply_id: 23300[/import]