You must login before being able to do this action
Haxe Forum > Optional parameters help
-
Warren Feb 03 at 02:06
Hi, I'm porting some AS3 code to Haxe and am stuck trying to get this code to compile:
//in the _log class public function formatOutcomeNode(charID:String, team:String, ?hpDelta:Int, ?apDelta:Int, ?xpDelta:Int, ?status:String, ?loot:String):Xml //elsewhere... _log.formatOutcomeNode(_character.id, _character.teamName, delta); //error: Function 'formatOutcomeNode' requires arguments : charID, team, ?hpDelta, ?apDelta, ?xpDelta, ?status, ?loot
This seems like it should work according to this documentation: http://haxe.org/ref/optional_args
What am I doing wrong?
-
Warren Feb 03 at 02:17
Aha, figured it out right after posting. I was passing 'delta' as a Float instead of an Int. I've been spoiled by AS3 coercing Numbers and ints fluidly on my behalf.
-
Dima Feb 03 at 12:15
You can reread this lesson http://haxe.org/ref/optional_args .
-
Dima Feb 03 at 12:16
*this lesson http://haxe.org/ref/optional_args
< Prev
| Page 1 / 1 |
Next >