Why there is no "version" field in widget:GetInfo()

Why there is no "version" field in widget:GetInfo()

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Why there is no "version" field in widget:GetInfo()

Post by slogic »

Why there is no "version" field in widget:GetInfo()? I think it is worth to make it standard. Scripters put it everywhere as they can imagine: name, description, comment. Currently you can reliably track widget version by date only.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Why there is no "version" field in widget:GetInfo()

Post by zwzsg »

Because the first widgets did not have this field, and everybody start coding widgets by copying old widgets.

Some widgets feature a version field, but now it's too late to add a version field to every widget out there.

I'd say new widgets should include this version field, and that any code reading the version field of a widget should handle version being undefined.

Btw, I noticed it's best to use a string and not a number, as decimal number don't show up too well: for exemple 1.3 gets printed as 1.2999999523163, while "1.3" stays 1.3.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Why there is no "version" field in widget:GetInfo()

Post by Pxtl »

Only thing with using a string is you lose alphanumeric sorting unless you include leading zeros. Versions are actually annoying to do properly, since you have to make sure that 1.10.123b is bigger than 1.9.444 - alpha sort will fail there, and numeric sort will crash because of the little 'b'. Does Lua have a "decimal" datatype?
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: Why there is no "version" field in widget:GetInfo()

Post by slogic »

Pxtl wrote:Does Lua have a "decimal" datatype?
Nope.

Code: Select all

 The possible results of this type() function are "nil" (a string, not the value nil), "number", "string", "boolean", "table", "function", "thread", and "userdata". 
Post Reply

Return to “Lua Scripts”