Haxe --interp arguments?

354 views
Skip to first unread message

Philippe Elsass

unread,
Aug 3, 2016, 4:06:04 AM8/3/16
to haxe...@googlegroups.com
Can you pass arguments to an interpreted neko script?
eg. haxe -main MyScript --interp

I'd like to avoid creating .n or temporary files.

--
Philippe

Mark Knol

unread,
Aug 3, 2016, 4:18:05 AM8/3/16
to Haxe
You can always use -D my_define=value

Andy Li

unread,
Aug 3, 2016, 4:24:28 AM8/3/16
to haxe...@googlegroups.com
Try this:

    -main Main
    --run arg1 arg2 arg3

Similar to --interp, Main will be run by the compiler interpreter.
Note that --run has to be the last compiler flag. Everything after --run is passed as Sys.args() to the program.

Also, if we can leave the args empty in hxml and pass them in cmdline as follows:

build.hxml:

    -main Main
    --run

cmd:

    haxe build.hxml arg1 arg2 arg3

Best,
Andy

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Philippe Elsass

unread,
Aug 3, 2016, 1:53:33 PM8/3/16
to Haxe

Thanks both.
Never heard of -run :)

Mark Knol

unread,
Aug 3, 2016, 8:05:10 PM8/3/16
to Haxe
I havent heard of that too :o it should be documented.

我每天睡不着

unread,
Aug 6, 2016, 1:03:51 AM8/6/16
to Haxe
I try to use `haxe -main Main --run`,  but it does not work..

Anton Nesterov

unread,
Aug 8, 2016, 2:52:29 AM8/8/16
to Haxe
You need to put main class name after '--run' and then arguments. Like

haxe --run Main arg1 arg2

суббота, 6 августа 2016 г., 8:03:51 UTC+3 пользователь 我每天睡不着 написал:
Reply all
Reply to author
Forward
0 new messages