I'm trying to use the input function from the Sys
class, but when I run the build and the prompt occurs, I'm unable to enter any input. What alternatives are there to Sys
, or what ought I do to resolve this? I've checked Haxelib and haven't found anything that I think can be used.
For reference, what I have written:
Sys.println("First player's name: ");
var p1:String = Sys.stdin().readLine();
My hxml args:
-main Main.hx
-cp src
-cp src/cards
-cp src/cards/library
-lib Random
-neko test.n
-cmd neko test.n
It works fine if you manually start the generated test.n
instead of doing that via -cmd
in the hxml. I suspect that the Haxe process does not direct input to the stdin of the -cmd
process or something like that.
If you still want to compile and run at the same time, I recommend creating a little .bat
(or .sh
if you're on Linux) script for this:
haxe build.hxml
neko test.n