about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-16 18:47:26 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-16 18:47:26 -0700
commit735ad25226e192eafd1bb7b2a094cf997fec8b8c (patch)
treeba7fe8b433fc8394eac54adc5abbdd2c47e4622a
parent753318f664cb7c86b9c7e50e6ca79b68e4a02b60 (diff)
downloadlines.love-735ad25226e192eafd1bb7b2a094cf997fec8b8c.tar.gz
always have a filename
When a filename is provided, we write to it. When it isn't we always
open the same file, and it persists between loads.
-rw-r--r--main.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/main.lua b/main.lua
index 80b0bfe..78dfa6f 100644
--- a/main.lua
+++ b/main.lua
@@ -45,7 +45,7 @@ function coord(n)  -- pixels to parts
   return math.floor(n*256/drawingw)
 end
 
-filename = nil
+filename = 'lines.txt'
 
 function love.load(arg)
   -- maximize window
@@ -60,10 +60,8 @@ function love.load(arg)
   love.keyboard.setTextInput(true)  -- bring up keyboard on touch screen
   if #arg > 0 then
     filename = arg[1]
-    lines = load_from_disk(filename)
-  else
-    table.insert(lines, '')
   end
+  lines = load_from_disk(filename)
 end
 
 function love.filedropped(file)