t.version

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
hryx
Party member
Posts: 110
Joined: Mon Mar 29, 2010 2:28 am
Location: SF<CA<USA

t.version

Post by hryx »

In love.conf, t.version is supposed to represent the intended Love version with a Lua number. But Love versions are things like "0.7.2", which is not a valid Lua number. Saying

Code: Select all

t.version = 0
is not meaningful, because features change enough between 0.x versions to break backwards-compatibility (in some cases).

So what use does t.version have? Is it going to change in the future, maybe to accept a string?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: t.version

Post by Robin »

It is currently not used, but if it will be in the future, it will probably be like this:

Code: Select all

-- 0.7.2
t.version = 072
-- 3.2.0
t.version = 320
Help us help you: attach a .love.
User avatar
hryx
Party member
Posts: 110
Joined: Mon Mar 29, 2010 2:28 am
Location: SF<CA<USA

Re: t.version

Post by hryx »

Cool. But to Lua, 032 looks like 32, so it could represent love version 32, or 3.2, or 0.3.2, etc. Why not use a string?

Code: Select all

t.version = '0.3.2'
Less ambiguous. I see the virtue in using numbers for the sake of comparisons (e.g. requiring at least version 0.7.0), but that can still be done easily by processing a string.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: t.version

Post by Taehl »

So far, I've been using "t.version = 0.72"...
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: t.version

Post by Robin »

hryx wrote:Cool. But to Lua, 032 looks like 32, so it could represent love version 32, or 3.2, or 0.3.2, etc.
No, because 3.2 would be 320, as I said. Version 32 would be 3200.
Taehl wrote:So far, I've been using "t.version = 0.72"...
The disadvantage of that is that version 0.1 is actually something like 0.100000000001. Damn floating points. :P
Help us help you: attach a .love.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: t.version

Post by miko »

Robin wrote:
hryx wrote:Cool. But to Lua, 032 looks like 32, so it could represent love version 32, or 3.2, or 0.3.2, etc.
No, because 3.2 would be 320, as I said. Version 32 would be 3200.
Taehl wrote:So far, I've been using "t.version = 0.72"...
The disadvantage of that is that version 0.1 is actually something like 0.100000000001. Damn floating points. :P
So what would be 3.11.2 and 3.1.12? I would prefer strings, this is how most GNU software works like. It is easy to do:

Code: Select all

major, minor, patchlevel=t.version:match('(%d+)%.(%d+)%.(%d+)%.')
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
hryx
Party member
Posts: 110
Joined: Mon Mar 29, 2010 2:28 am
Location: SF<CA<USA

Re: t.version

Post by hryx »

Robin wrote:No, because 3.2 would be 320, as I said. Version 32 would be 3200.
Oh, I see. This number would always assume x.y.z version numbering. That works, but it relies on y and z being single digits. It assumes there will never be a version like 0.8.12 or 2.10.0, where there have been more than 9 minor or incremental version upgrades.

For that reason, I still think that's less clear and flexible than using a string.

Edit: miko beat me to the same point.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: t.version

Post by Robin »

Take it up with the devs, I'd say. ;)

Open a ticket or something.
Help us help you: attach a .love.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: t.version

Post by BlackBulletIV »

I personally use something like

Code: Select all

t.version = 072
because that's the format used internally by LOVE.
User avatar
hryx
Party member
Posts: 110
Joined: Mon Mar 29, 2010 2:28 am
Location: SF<CA<USA

Re: t.version

Post by hryx »

I have opened this up as ticket #299 on the issue tracker.

Miko, I referred to your parsing statement. But I took off the final "%.", which is superfluous.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 13 guests