lua-users home
lua-l archive

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

Hello, everyone!

I made this chained validation module. It's called valua and was originally bundled with another project of mine (Sailor MVC), but since it works separately, I sent it to the LuaRocks repository. 

The validation objects are reusable and if a test fails at the beginning of the chain, it will break the chain and won't test the rest of it.

    local valua = require "valua"
    local test = valua:new().integer().min(18)
    test(23.7) -- false
    test(5) -- false
    test(19) -- true

The license is MIT, use at will, I hope you enjoy it! =)