Just add to this, if you are describing extern for an external JavaScript library (or Python, Lua, or any target language that supports the rest parameter , for example ...rest ), there is a specific Haxe type, haxe.extern.Rest , to express this .
Here is an example showing that the JavaScript function Math.max processes variables: http://try.haxe.org/#4607C
class Test { static function main() { trace("JS Math.max takes varargs:"); trace(MyMath.max(1,2,3,4)); // 4 trace(MyMath.max(5,6)); // 6 } } @:native("Math") extern class MyMath { static function max(a:Float, b:Float, rest:haxe.extern.Rest<Float>):Float; }
Please note that the standard Haxe library does not define Math.max with Rest , as its goal is cross-platform compatibility.
source share