From e756e71b9548f484910126119d057f9e819f1896 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Mon, 27 Sep 2021 19:47:16 -0600 Subject: [PATCH] enterNumber for NAT playground --- .../source/PlayState.kiss | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/projects/nat-flixel-desktop-playground/source/PlayState.kiss b/projects/nat-flixel-desktop-playground/source/PlayState.kiss index 70cc4f6b..54049a0d 100644 --- a/projects/nat-flixel-desktop-playground/source/PlayState.kiss +++ b/projects/nat-flixel-desktop-playground/source/PlayState.kiss @@ -130,7 +130,15 @@ (showUI textInput)) (method :Void enterNumber [prompt resolve min max &opt inStepsOf] - (resolve 0)) + (enterText prompt + ->:Void [numberStr] + (let [number + (try (Std.parseFloat numberStr) + (catch [e] + (reportError "Not a number: $numberStr") + (return)))] + (resolve number)) + Math.POSITIVE_INFINITY)) (method :Void chooseEntry [prompt :Archive archive resolve] (resolve null))