Skip to content

Instantly share code, notes, and snippets.

@DavisDevelopment
Created October 28, 2015 10:24
Show Gist options
  • Save DavisDevelopment/b29f9355349aba2a794e to your computer and use it in GitHub Desktop.
Save DavisDevelopment/b29f9355349aba2a794e to your computer and use it in GitHub Desktop.
tnative examples in Haxe 3.2
package ;
// https://github.com/DavisDevelopment/tnative/blob/master/src/tannus/io/Prompt.hx
import tannus.io.Prompt;
class PrompUse {
/* Program's main function */
public static function main():Void {
var namePrompt:Prompt = new Prompt("What's your name? ");
namePrompt.getLine( handle_input );
/*
== Example Run ==
>haxe -lib tnative -neko test.n -main PromptUse
>neko test.n
>what's your name? Ryan Davis
the user entered: Ryan Davis
*/
}
/* function invoked when input has been received */
private static function handle_input(line : String):Void {
trace('the user entered: ' + line);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment