From 8acab5f12cec40a94c536e5bc89cd87535c16985 Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Mon, 24 Dec 2018 09:11:37 +0300 Subject: [PATCH] Added "Calculator" application for future testing #3 --- Applications/Calculator/Main.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Applications/Calculator/Main.lua b/Applications/Calculator/Main.lua index 085bb14d..882cb89b 100644 --- a/Applications/Calculator/Main.lua +++ b/Applications/Calculator/Main.lua @@ -80,7 +80,12 @@ modeList.selectedItem = 2 local displayWidget = displayContainer:addChild(GUI.object(4, 1, window.width - 6, displayHeight)) local function parseFloat(v) - return tostring(v * 1.0):match("(.+)%.(.+)") + local integer, fractional = tostring(v * 1.0):match("(.+)%.(.+)") + if integer then + return integer, fractional + else + return tostring(v), "0" + end end local function format(v)