Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haxe - Print command line arguments

Tags:

haxe

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]);
        }
    }
}
like image 802
Anderson Green Avatar asked Oct 30 '12 04:10

Anderson Green


1 Answers

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);
    }
}
like image 70
Andy Li Avatar answered Sep 21 '22 10:09

Andy Li