if you intend it to parse version strings of existing packages that use
3-part version numbers, I don't think it will.
Thanks for your comments.
My intention with semver was implementing what the
semver.org page says; hence its name.
Since
semver.org doesn't contemplate anything before the version numbers, so the lib doesn't implement that.
There is also an interface problem. The lib accepts two kinds of parameters - either you pass in a string for it to "parse", or you pass every number separatedly:
v(1,2,3,'-alpha')
v('1.2.3-alpha')
Right now both versions of the constructor are aligned - they throw errors on the same kind of things. I think it would be weird to accept an "extra" string bit on the string-only constructor.
A lib implementing those features should not be called semver - maybe luaversion, or similar. Please don't misunderstand me: I'm not saying it's a bad idea to make such a lib - I just think semver is just not the place.
Until such a lib is done, one can use :match("[^ ]+$") :
> = _VERSION:match("[^ ]+$")
5.1
> = socket._VERSION:match("[^ ]+$")
2.0.2
I hope this helps.