I'm an old coder, I started on mainframes about 10 years before the PC revolution and moved to PC programming as my profession after my stint in my county's armed forces. My point there is I have coded in a lot of languages and paradigms. I code AS3 and like the similarities between that and Lua. I read https://love2d.org/wiki/Easy_GUI_System where he seems to be using classes and prototypical features of the language to "bolt on" methods that react to clicking on them or hovering over them. Unfortunately I could not find his code (seems to be missing from github).
As I was writing this, I remember reading http://stackoverflow.com/questions/2207 ... -clickable where it appears that the "love.update(dt)" function is creating an anonymous function that corresponds to an already existing Love2D function. To me that seems like bad coding but maybe each of the love.mousepressed functions will all fire. I guess this is similar to the Observer pattern that notifies as many listeners as exist.
If I had the code below, would both functions "fire"?
Code: Select all
function love.update(dt)
function love.mousepressed( x, y)
if x > 440 and x < 540 and y > 380 and y < 410 then
love.event.quit()
end
end
end
function love.mousepressed(x, y, button)
_GameOn = true
end