I'm currently working on a new UI library for love2d. I'm implementing a custom event dispatcher for my new library and notice something in the love.run default implementation. I'm using the version 11.3
The thing that bothers me is the following code line:
Code: Select all
if name == "quit" then
if not love.quit or not love.quit() then
return a or 0
end
end
I'm thinking of adding another parameter for all love event callbacks in order to indicate if my library already used this event for one of the UI elements. I just add a system to add event dispatcher for UI elements and give them own callback functions. This will prevent accidentally breaking the library apart while still using the love event callbacks for normal stuff. I already have a workaround specifically for the love.quit callback. But I'm still wondering why this "a" is here and what purpose it have in combination with the quit event.
Code: Select all
if love.event then
love.event.pump()
for n, a, b, c, d, e, f in love.event.poll() do
local g = yui.event.dispatcher(n, a, b, c, d, e, f)
if n == "quit" then
if not love.quit or not love.quit(g) then
return a or 0
end
end
a = a or g
b = b or g
c = c or g
d = d or g
e = e or g
f = f or g
love.handlers[n](a, b, c, d, e, f, g)
end
end