summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-11-02 23:41:40 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2018-11-05 07:18:08 +0100
commitb5fb9781a6f40d328f10e4c0d5cd818d9e22173a (patch)
tree7b0c08db82062bbc7392fc0cce1f9740d83556e5
parent85079483c5595c2a04774ae9fbf529719eaec9fa (diff)
downloadrockbox-b5fb9781a6f40d328f10e4c0d5cd818d9e22173a.tar.gz
rockbox-b5fb9781a6f40d328f10e4c0d5cd818d9e22173a.zip
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
-rw-r--r--apps/plugins/pixel-painter.lua10
1 files 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)
232 if f ~= nil then 232 if f ~= nil then
233 local highscores = {} 233 local highscores = {}
234 for i=1,3 do 234 for i=1,3 do
235 local line = f:read() 235 local line = f:read() or ""
236 local value = false 236 local value = false
237 if line ~= nil then 237 if line ~= "" then
238 value = tonumber(line) 238 value = tonumber(line)
239 end 239 end
240 240
@@ -307,9 +307,9 @@ if rb ~= nil then
307 } 307 }
308 DEFAULT_DIFFICULTY = 2 --1: Easy, 2: Normal, 3: Hard 308 DEFAULT_DIFFICULTY = 2 --1: Easy, 2: Normal, 3: Hard
309 309
310 FILES_ROOT = "/.rockbox/rocks/games/" 310 FILES_ROOT = rb.PLUGIN_GAMES_DATA_DIR
311 SCORES_FILE = FILES_ROOT.."pixel-painter.score" 311 SCORES_FILE = FILES_ROOT.."/pixel-painter.score"
312 SAVE_FILE = FILES_ROOT.."pixel-painter.save" 312 SAVE_FILE = FILES_ROOT.."/pixel-painter.save"
313 r,w,TEXT_LINE_HEIGHT = rb.font_getstringsize(" ", rb.FONT_UI) --Get font height 313 r,w,TEXT_LINE_HEIGHT = rb.font_getstringsize(" ", rb.FONT_UI) --Get font height
314 --Determine which layout to use by considering the screen dimensions 314 --Determine which layout to use by considering the screen dimensions
315 --the +9 is so we have space for the chooser 315 --the +9 is so we have space for the chooser