5
votes

Using the Haxe programming language, is it possible to print the command line arguments that are passed to an application?

I'm trying to re-write this Java program (which simply prints the command line arguments) in Haxe.

public class JavaExample{
    public static void main(String[] args){
        for(int i = 0; i < args.length; i++){
            System.out.println(args[i]);
        }
    }
}
1
It looks like there might be a solution for php, neko, and cpp (using the Sys class, specifically Sys.args): haxe.org/api/sys - Anderson Green

1 Answers

9
votes

Since targets like JS(in browser) and Flash do not have concept of command line arguments. Haxe put such "system" target things in Sys and the top level sys package.

class Example {
    public static function main():Void {
        for (arg in Sys.args())
            Sys.println(arg);
    }
}