lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi there!

(I don't know if it's ok to announce new libs on this list. If not, please accept my apologies)

I was looking for a way to handle semantic versions as specified in

I could not find a lib that did that, so I created my own - It's available at

Quick sneak peek:

    local v = require 'semver'
    local v1 = v(1,0,0)
    local v1_5 = v('1.5.0')
    local v2 = v'2.0.0' -- parents are optional for strings ...
    local v2_alpha = v'2.0.0-alpha'
    local v1_5_build_1 = v'1.5.0+build.1'

    v1_5.major -- 1
    v1_5.minor -- 5
    v1_5.patch -- 0 -- 'build.1'

    v1 < v1_5 -- true
    v1 ^ v1_5 -- true, it's "safe to upgrade" from 1.0.0 to 1.5.0
    v2_alpha < v2 -- true, prereleases go before official releases
    v1_5 < v1_5_build_1 -- true, official releases go after builds

Most of the code in the lib is there to deal with the edge cases of handling and parsing prereleases and builds. The tests are inside the spec/ folder.

Let me know if you have any feedback/issues with it!