TangentFoxy / Pop.Box

(ON HOLD) Pop.Box is an easy to use GUI library for the LÖVE engine, intended for rapid prototyping.
http://guard13007.github.io/Pop.Box/docs
MIT License
8 stars 4 forks source link

Event-handling functions should return false to indicate they have not handled an event, anything else is accepted as handled #54

Open TangentFoxy opened 7 years ago

TangentFoxy commented 7 years ago

Right now they have to explicitly return true, which may be accidentally triggered while writing MoonScript with its automatic return functionality, and requires remembering this constantly. Instead, anything other than an explicit false should be considered success.

The logic is that an element without a handler won't even have anything called, so that works automatically, anything with a handler is typically expected to handle it automatically. The rare case is when a handler DOESN'T handle something, not when it does. So the programmer should only have to explicitly return something for that rare case.

TangentFoxy commented 7 years ago

The way the functions work that handle these events prevents this from working, at least in its present state. I think I can solve the problem by changing how I use the library or introducing new variables to check if a function is actually being called vs the default nil values.

Try it again as-is first, with the default values being FALSE. I might have miscalculated..