Tiled Map Loading Help

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.
Post Reply
User avatar
MetalMelnic
Prole
Posts: 10
Joined: Sat Mar 04, 2017 3:52 am

Tiled Map Loading Help

Post by MetalMelnic »

I am trying to import a tiled map in .lua format into love2d by following a tutorial series on the Simple-Tiled-Implementation library from GitHub. I attempted to get the map file from a root folder called maps, but that did not work so I moved the file to the sti folder in the library, it still did not work and both times the program crashed. The error message displayed was: init.lua: 44.attempt to call a nil value. I checked in the code and tried the included examples and they worked fine. I would be nice if I could get some help on this, or further clarification.

Link to Github:
https://github.com/karai17/Simple-Tiled-Implementation

Link to Lua Space:
http://lua.space/gamedev/using-tiled-maps-in-love

Thanks for your time.
Before we learn to run, we must first learn to walk;
before we learn to walk, we must first learn to crawl;
Why should programming be any different?
User avatar
erasio
Party member
Posts: 118
Joined: Wed Mar 15, 2017 8:52 am
Location: Germany

Re: Tiled Map Loading Help

Post by erasio »

I think the important question is what does your code look like?

What value is nil? And why is it nil?

Nil basically means it doesn't exist at this point in time. So you must've skipped / overlooked one step that creates this variable or named it differently.

Without your code to look at it's impossible to say much more than that though but maybe it already helps?
User avatar
MetalMelnic
Prole
Posts: 10
Joined: Sat Mar 04, 2017 3:52 am

Re: Tiled Map Loading Help

Post by MetalMelnic »

Sorry, I forgot to add the example of my code.
Attachments
Library Tutorial - Simple Tiled Loader.zip
The .love file crashes anyways
(557.7 KiB) Downloaded 170 times
Before we learn to run, we must first learn to walk;
before we learn to walk, we must first learn to crawl;
Why should programming be any different?
User avatar
erasio
Party member
Posts: 118
Joined: Wed Mar 15, 2017 8:52 am
Location: Germany

Re: Tiled Map Loading Help

Post by erasio »

A quick look into the sti file at the point of the error and we can see that this issue is caused when trying to load the file with love.filesystem.load().

So that's probably our input with the file location provided.

Since it's called with love.filesystem.load() it starts searching from the root folder. Not in STI/sti/.

So you'd need to provide that on load. "STI/sti/desert.lua".

Also your file has two dots. It's "desert..lua". You either have to remove one from the filename or add another dot for loading the file.

Cheers
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 11 guests