From b5fb9781a6f40d328f10e4c0d5cd818d9e22173a Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Fri, 2 Nov 2018 23:41:40 -0400 Subject: [PATCH] Lua fix pixel-painter score save pixel-painter was depending on the old readline code that returned nil for empty lines however empty lines should have returned an empty string Change-Id: Ic06ce920a7ab38e1fb8f7197d637e74ed9e35653 --- apps/plugins/pixel-painter.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/plugins/pixel-painter.lua b/apps/plugins/pixel-painter.lua index d2bd700d74..5c1981a7a2 100644 --- a/apps/plugins/pixel-painter.lua +++ b/apps/plugins/pixel-painter.lua @@ -232,9 +232,9 @@ function load_scores(filename) if f ~= nil then local highscores = {} for i=1,3 do - local line = f:read() + local line = f:read() or "" local value = false - if line ~= nil then + if line ~= "" then value = tonumber(line) end @@ -307,9 +307,9 @@ if rb ~= nil then } DEFAULT_DIFFICULTY = 2 --1: Easy, 2: Normal, 3: Hard - FILES_ROOT = "/.rockbox/rocks/games/" - SCORES_FILE = FILES_ROOT.."pixel-painter.score" - SAVE_FILE = FILES_ROOT.."pixel-painter.save" + FILES_ROOT = rb.PLUGIN_GAMES_DATA_DIR + SCORES_FILE = FILES_ROOT.."/pixel-painter.score" + SAVE_FILE = FILES_ROOT.."/pixel-painter.save" r,w,TEXT_LINE_HEIGHT = rb.font_getstringsize(" ", rb.FONT_UI) --Get font height --Determine which layout to use by considering the screen dimensions --the +9 is so we have space for the chooser