Error 'calling on bad self'

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
Linkpy
Party member
Posts: 102
Joined: Fri Aug 29, 2014 6:05 pm
Location: France
Contact:

Error 'calling on bad self'

Post by Linkpy »

Hello !

I've got a little problem, and I don't know how to resolve it...
I'm making a GUI for a music player (yes, a music player with Löve :crazy: ) and I'm working on the base class 'component'. A component has got a position ( X, Y ) and a size ( W, H ) and I use some linear interpolation for animation. So, to have the X position, I need to use component:get_x function. But, for component:get_y and component:get_h, I've got this error :

Code: Select all

Error: main.lua:12: calling 'get_y' on bad self (number expected, got nil)
stack traceback:
	[C]: in function 'get_y'
	main.lua:12: in function 'load'
	[string "boot.lua"]:407: in function <[string "boot.lua"]:399>
	[C]: in function 'xpcall'
And I don't know why I got that... I've tryed to change get_y to getY, but I got the same error... If someone can help me, there are all the code : https://github.com/linkpy/simple-player .

Thanks for your answers :death:
Founder of NeoShadow Studio. Currently working on the project "Sirami".
github / linkpy
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Error 'calling on bad self'

Post by s-ol »

Linkpy wrote:Hello !

I've got a little problem, and I don't know how to resolve it...
I'm making a GUI for a music player (yes, a music player with Löve :crazy: ) and I'm working on the base class 'component'. A component has got a position ( X, Y ) and a size ( W, H ) and I use some linear interpolation for animation. So, to have the X position, I need to use component:get_x function. But, for component:get_y and component:get_h, I've got this error :

Code: Select all

Error: main.lua:12: calling 'get_y' on bad self (number expected, got nil)
stack traceback:
	[C]: in function 'get_y'
	main.lua:12: in function 'load'
	[string "boot.lua"]:407: in function <[string "boot.lua"]:399>
	[C]: in function 'xpcall'
And I don't know why I got that... I've tryed to change get_y to getY, but I got the same error... If someone can help me, there are all the code : https://github.com/linkpy/simple-player .

Thanks for your answers :death:
Did you call the method like component:get_y()? it looks like you forgot the : and instead did component.get_y().

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
User avatar
Linkpy
Party member
Posts: 102
Joined: Fri Aug 29, 2014 6:05 pm
Location: France
Contact:

Re: Error 'calling on bad self'

Post by Linkpy »

I ckecked it, but this not the problem because :

Code: Select all

component.get_y (component)
Doesn't work too...
Founder of NeoShadow Studio. Currently working on the project "Sirami".
github / linkpy
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Error 'calling on bad self'

Post by bartbes »

So the error location is actually masked because of all the tail calls you're doing, which makes this considerably harder to debug, but the error message seems related to ffi.metatype, or the ffi in general.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests