Book Image

haXe 2 Beginner's Guide

5 (1)
Book Image

haXe 2 Beginner's Guide

5 (1)

Overview of this book

Table of Contents (21 chapters)
haxe 2
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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;
   }