[SOLVED] Bad Argument #1 to 'add' Using Tiled Map Editor

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.
Trinica
Prole
Posts: 8
Joined: Sat Feb 14, 2015 3:45 am

[SOLVED] Bad Argument #1 to 'add' Using Tiled Map Editor

Post by Trinica »

Hi guys,

I'm very new to LOVE2d and I am attempting to work through a book titled "LOVE for Lua Game Programming" by Darmie Akinlaja. It is available as a free e-book download if anyone would like to assist me. I am currently stuck on page 40 adding a level from Tiled to be used in my game via Advanced Tiled Loader. I have made sure that every line of code is the exact same as the book, but when I attempt to run the program I receive the error "Advanced-Tiled-Loader-master/TileLayer.lua:163:bad argument #1 to 'add' (number expected, got userdata)."

I looked in TileLayer.lua and I'm not sure if I need to mess with THAT or something else in my code (main.lua). I thought it much more likely that I would need to fix something in my code, even though it says the error is in that file - not sure I should need to edit that. I will include my .love file so that you can look at it. Anyone have any idea why it's acting up?

Thanks in advance!
Attachments
MapTest.love
(65.66 KiB) Downloaded 228 times
Last edited by Trinica on Fri Feb 20, 2015 3:41 pm, edited 1 time in total.
Piggles
Prole
Posts: 10
Joined: Wed Dec 22, 2010 6:08 pm

Re: Bad Argument #1 to 'add' Using Tiled Map Editor

Post by Piggles »

At what point do you get the error? The love file you attached seems to run fine for me - displays a yellow background with some floating platforms.
Trinica
Prole
Posts: 8
Joined: Sat Feb 14, 2015 3:45 am

Re: Bad Argument #1 to 'add' Using Tiled Map Editor

Post by Trinica »

Really?? It happens almost instantly for me. I see a black screen for a moment, then it displays the error. I have yet to see the map. =/
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Bad Argument #1 to 'add' Using Tiled Map Editor

Post by s-ol »

Trinica wrote:Really?? It happens almost instantly for me. I see a black screen for a moment, then it displays the error. I have yet to see the map. =/
Maybe you are using a different version of löve?

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Trinica
Prole
Posts: 8
Joined: Sat Feb 14, 2015 3:45 am

Re: Bad Argument #1 to 'add' Using Tiled Map Editor

Post by Trinica »

S0lll0s wrote:
Trinica wrote:Really?? It happens almost instantly for me. I see a black screen for a moment, then it displays the error. I have yet to see the map. =/
Maybe you are using a different version of löve?
That is very probable. I just checked my version of löve and I am evidently running 0.8.0. I was under the impression that I was running the latest version, but that apparently is not the case. I don't really understand how I'm running that version, I have the official repository added and I've updated it just now, but I'm still on 0.8.0. The .deb release on the front page will not work for me either, it just presents me with an error. Fun stuff.

EDIT: It appears as if my distribution is broken as of last night. I cannot update any packages or repositories and my package manager gives me an error for everything I try to do. I will return once I have sorted that out. I love Linux to death, but instances like this remind me why no distribution is ready for prime time/massive distribution. =[
Last edited by Trinica on Sat Feb 14, 2015 2:12 pm, edited 1 time in total.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Bad Argument #1 to 'add' Using Tiled Map Editor

Post by s-ol »

Trinica wrote:
S0lll0s wrote:
Trinica wrote:Really?? It happens almost instantly for me. I see a black screen for a moment, then it displays the error. I have yet to see the map. =/
Maybe you are using a different version of löve?
That is very probable. I just checked my version of löve and I am evidently running 0.8.0. I was under the impression that I was running the latest version, but that apparently is not the case. I don't really understand how I'm running that version, I have the official repository added and I've updated it just now, but I'm still on 0.8.0. The .deb release on the front page will not work for me either, it just presents me with an error. Fun stuff.
Well whats the error? if you are on debian there wont be a recent version in the repos 99% of the time (because debian isn't rolling-releasing and takes ages to integrate updates). Your options are fixing the dependencies or fixing the dependencies and compiling from source ^^

You will probably find more dependencies that aren't in the repos (SDL2), so you will have to compile some of them. It should be pretty doable though; a friend of mine did it with next-to-no linux knowledge.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Trinica
Prole
Posts: 8
Joined: Sat Feb 14, 2015 3:45 am

Re: Bad Argument #1 to 'add' Using Tiled Map Editor

Post by Trinica »

S0lll0s wrote: Well whats the error? if you are on debian there wont be a recent version in the repos 99% of the time (because debian isn't rolling-releasing and takes ages to integrate updates). Your options are fixing the dependencies or fixing the dependencies and compiling from source ^^

You will probably find more dependencies that aren't in the repos (SDL2), so you will have to compile some of them. It should be pretty doable though; a friend of mine did it with next-to-no linux knowledge.
Software index is broken
This is a major failure of your software management system. Please check for broken packages with synaptic, check the file permissions and correctness of the file '/etc/apt/sources.list' and reload the software information with: 'sudo apt-get update' and 'sudo apt-get install -f'.

Huzzahhhh. I'm not even sure how to check for dependencies if it won't open a .deb file at all.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Bad Argument #1 to 'add' Using Tiled Map Editor

Post by s-ol »

Trinica wrote: Software index is broken
This is a major failure of your software management system. Please check for broken packages with synaptic, check the file permissions and correctness of the file '/etc/apt/sources.list' and reload the software information with: 'sudo apt-get update' and 'sudo apt-get install -f'.

Huzzahhhh. I'm not even sure how to check for dependencies if it won't open a .deb file at all.
Wow, you somehow bricked your apt... Post sources.list or try fixing it yourself, the message is very detailed already.

Also the problem isn't opening the .deb, it fails before that because apts data is bricked.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Trinica
Prole
Posts: 8
Joined: Sat Feb 14, 2015 3:45 am

Re: Bad Argument #1 to 'add' Using Tiled Map Editor

Post by Trinica »

http://uberstudent.com/phpBB/viewtopic. ... lit=#p2626

So.....it turns out this is probably why I can't do anything. They're upgrading servers for my OS's repositories. Whether or not that's the entire issue is yet to be seen, but I should be able to try again in a few hours. =p
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Bad Argument #1 to 'add' Using Tiled Map Editor

Post by s-ol »

Trinica wrote:http://uberstudent.com/phpBB/viewtopic. ... lit=#p2626

So.....it turns out this is probably why I can't do anything. They're upgrading servers for my OS's repositories. Whether or not that's the entire issue is yet to be seen, but I should be able to try again in a few hours. =p
By your error message, It can't be the only issue :/

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest