help with "expected userdata"

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
AtomCastDev
Prole
Posts: 37
Joined: Fri Aug 02, 2013 1:44 pm

help with "expected userdata"

Post by AtomCastDev » Tue Aug 06, 2013 4:43 pm

Whenever I press the 'a' key on my keyboard to make my char go left, the first four frames will play and go left but after the four frame it will give out an error and exit,this only happened when I applied animations.
---------------------------------------------------------------------------------------------------------------------------------------
error:
includes/player.lua:line 83: Incorrect parameter type:expected userdata.

Traceback

[C]: in function 'draw'

here is the .love


http://www.mediafire.com/?9xwa9hr8185gmbf
Sharing the one world

Also check out my friend's game!
http://love2d.org/forums/viewtopic.php?f=5&t=43276

User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: help with "expected userdata"

Post by Ranguna259 » Tue Aug 06, 2013 5:58 pm

Easy fix: Use AnAL
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.

AtomCastDev
Prole
Posts: 37
Joined: Fri Aug 02, 2013 1:44 pm

Re: help with "expected userdata"

Post by AtomCastDev » Tue Aug 06, 2013 6:00 pm

Ranguna259 wrote:Easy fix: Use AnAL
I don't want to re-code everything in my game just to add in the AnAl animation library
Sharing the one world

Also check out my friend's game!
http://love2d.org/forums/viewtopic.php?f=5&t=43276

User avatar
DaedalusYoung
Party member
Posts: 402
Joined: Sun Jul 14, 2013 8:04 pm

Re: help with "expected userdata"

Post by DaedalusYoung » Tue Aug 06, 2013 6:17 pm

Simple.

In includes/player.lua, on line 57 you increase player.pnum. But you forget to check if player.pnum surpasses 4. So, add the following lines after line 59:

Code: Select all


    if player.pnum > 4 then 
   player.pnum = 1
    end


AtomCastDev
Prole
Posts: 37
Joined: Fri Aug 02, 2013 1:44 pm

Re: help with "expected userdata"

Post by AtomCastDev » Tue Aug 06, 2013 6:44 pm

Simple.

In includes/player.lua, on line 57 you increase player.pnum. But you forget to check if player.pnum surpasses 4. So, add the following lines after line 59:
thank you thank you thank you! I knew that the answer would be simple but I just kept over looking it!
Sharing the one world

Also check out my friend's game!
http://love2d.org/forums/viewtopic.php?f=5&t=43276

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests