Up to 9000

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
719 I think I just fell in love with this lua framework. As I can share code between my server and client with it.
Code:
local mymodule = {}

function mymodule.foo()
    print("Hello World!")
end
function mymodule.validatePossibleValidUser(valua,userName,password)
    print(valua)
    if(valua:new().type("string").len(3,5)(userName)) then
        if(valua:new().type("string").len(3,5)(password)) then
            return true;
        else
            return false,"password doesn't match"
        end
    else
        return false, "name doesn't match"
    end
end
return mymodule
Code:
function main.index(page)
   --currently it gets loaded in a controller but it should work the same inside a model (or even view)
   local valua = require "valua"
   local test = require "test"
   test.foo()
   local possible,error=test.validatePossibleValidUser(valua,"test","lol")
   print(possible,error)
   page:render("index")
 
end
Code:
<?lua@client
   local valua = require "valua"
   local test= require "test"
   local possible,error=test.validatePossibleValidUser(valua,"some","awekdwkdwkldw")
   print(possible,error)
   
?>