Check LÖVE version at runtime?
Check LÖVE version at runtime?
I've searched a bit for this but found nothing. Is there a way to determine the LÖVE version at runtime? My game uses gamepads, so it matters if it's running on LÖVE 0.8 or 0.7.2 or some other version. It would also be nice to have shaders implemented, and showing only if it's running in LÖVE 0.8. Or are we doomed to develop for specific LÖVE versions?
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Check LÖVE version at runtime?
There's a variable love._version, that stores the current version. Do note that in 0.8.0 love._version is equal to what love._version_string was in earlier versions (so a string representation).
As for shaders, just because people run 0.8.0 doesn't mean they support pixeleffects, there's love.graphics.isSupported for that.
As for shaders, just because people run 0.8.0 doesn't mean they support pixeleffects, there's love.graphics.isSupported for that.
Re: Check LÖVE version at runtime?
So there's not way to check if it's "0.8 or higher"? I guess the best to do is to check is it's 0.7.1 or 0.7.2, and if it's not, assume that it's 0.8 or higher...? Trying to future proof here.bartbes wrote:There's a variable love._version, that stores the current version. Do note that in 0.8.0 love._version is equal to what love._version_string was in earlier versions (so a string representation).
As for shaders, just because people run 0.8.0 doesn't mean they support pixeleffects, there's love.graphics.isSupported for that.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Check LÖVE version at runtime?
As I said, you can check love._version. 0.8.0 also brings love._version_major/minor/revision (pick one ).
Re: Check LÖVE version at runtime?
But you just said that 0.8.0 gives love._version as a string. Or is it like java where the string '0.8.0' is "larger than" '0.7.2'?bartbes wrote:As I said, you can check love._version. 0.8.0 also brings love._version_major/minor/revision (pick one ).
And does love._version_major/minor/whatever give numbers or strings?
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: Check LÖVE version at runtime?
T-Bone wrote:So there's not way to check if it's "0.8 or higher"?
Code: Select all
if type(love._version) == "string" and love._version >= "0.8.0" then
Help us help you: attach a .love.
Re: Check LÖVE version at runtime?
I had no idea you could compare strings in lua. Nice!Robin wrote:T-Bone wrote:So there's not way to check if it's "0.8 or higher"?Code: Select all
if type(love._version) == "string" and love._version >= "0.8.0" then
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Who is online
Users browsing this forum: Google [Bot] and 11 guests