O'Reilly logo

haXe 2 by Benjamin Dasnois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—Adding a user

Now, let's create the function to add a user. It will take the login and the password as parameters and will return the created object as follows:

public static function createUser(login : String, password : String) : hxBlog.User
{
var u = new hxBlog.User();
u.username = login;
u.setPassword(password);
u.insert();
return u;
}

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required