Monday, May 13, 2013

Function Types In Haxe

http://stackoverflow.com/questions/14025739/passing-a-function-as-a-parameter-in-haxe

 // fType : T -> Void
 // argument means that it takes a function "fType"
 // that takes one argument of type "T" and returns Void.
 public function applyFuncToAll( fType : T -> Void ):Void
 {
  cur = first;
  while (true)
  {
   //Call bound function on current object in list.
   fType( cur.obj );
   
   if (cur.hasNext)
   {
    cur = cur.next;
   }
   else
   {
    break;
   }
  }
 }

No comments:

Post a Comment