-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use LÖVE's love.math.random when available #12
Comments
Just a question in ignorance as I don't know the difference between the functions, but what's the reason to use love's math function as an override? Additionally, shouldn't that be an override you set outside of the lume library rather than expecting lume itself to be aware of another library being present? |
@jaythomas |
Thanks, @EntranceJew. That answers my first question. The reason I asked the second question is because my concern is that by making it the library's responsibility to have an awareness of love's random function, you are introducing a bias towards using this library in conjunction with love. As a user of this library, I may be using lume inside a service where love is not defined globally, or perhaps I'm not using love at all. Personally, I think it makes more sense to implement a "mixin" function where you can register new functions or override existing top-level functions like lume.mixin('math_random', love.math.random) This way if I wanted to use a completely different random function, or if love decided to move the random function somewhere else, the library wouldn't care. Not its job to be responsible for other librarys' APIs. Again, just my opinion. |
Agreeing with several for @jaythomas's points, mainly:
So I won't be including this, nor merging the corresponding pull request (#13). That being said, I do like the idea of supporting a mechanism for the user to supply their own I'll have to think about the best way to go about this (in terms of naming, and exactly how the provided |
love.math.random
should always be preferred instead ofmath.random
when LÖVE is used.The text was updated successfully, but these errors were encountered: