Hi, I started making my game like a few weeks ago. I am having problems with goo buttons - I cant call onClick function, every time I tried external function I am having an "Attempt to index global 'button' (a nill value), and if I placing this function in my mainMenu() function, there all the buttons are creating it just don't work Help plz!
(and sorry if my english forces you to facepalm)
Goo misunderstating
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Goo misunderstating
Goo buttons?
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: Goo misunderstating
Yup, this lib - http://love2d.org/wiki/Goo
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Goo misunderstating
Like the Rules say: could you upload a .love of your project to the forum? Otherwise it will be hard or even impossible to help you.
Help us help you: attach a .love.
Re: Goo misunderstating
You don't seem to call goo.mousepressed()... I've never used goo but I guess you should add like
or something.
Code: Select all
function love.mousepressed(x,y,button)
goo:mousepressed(x,y,button)
end
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Goo misunderstating
Thanks.
Hm, I can't reproduce the error you're getting. Could you say exactly what you do to get the error? And are you sure this is the exact same version that errors?
Hm, I can't reproduce the error you're getting. Could you say exactly what you do to get the error? And are you sure this is the exact same version that errors?
Help us help you: attach a .love.
Re: Goo misunderstating
Thanks for replying
I want buttons to do something, so i am adding
to the bottom and TA DA - error
Am i doing it wrong? Because if i adding this function at the mainMenu it just does nothing
I want buttons to do something, so i am adding
Code: Select all
function exbutton:onClick(x, y, button)
love.event.push("q")
end
Am i doing it wrong? Because if i adding this function at the mainMenu it just does nothing
Re: Goo misunderstating
That function is defined in the global scope, which means Lua tries to create it before love.load has been run.
At this point, exbutton has not been created yet, and trying to create a new value in a table that doesn't exist results in an error.
Try moving function exbutton:onclick ... end to line 56.
At this point, exbutton has not been created yet, and trying to create a new value in a table that doesn't exist results in an error.
Try moving function exbutton:onclick ... end to line 56.
Re: Goo misunderstating
At line 56 it does absolutely nothing, but the game starts normally
Who is online
Users browsing this forum: Google [Bot] and 6 guests