about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-15 21:27:15 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-15 22:02:53 -0700
commit935f2a62158bf5d1628600f90450ceb901aed3ba (patch)
treef7fd2e5c0fea7bde00297786bb813d76d2c20a67
parent3be553031ea33c6b4f0f4623e954d2b5febe5e88 (diff)
downloadlines.love-935f2a62158bf5d1628600f90450ceb901aed3ba.tar.gz
autosave on keystrokes
-rw-r--r--main.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 658d94d..f60de6b 100644
--- a/main.lua
+++ b/main.lua
@@ -239,7 +239,9 @@ function love.mousereleased(x,y, button)
       lines.current = nil
     end
   end
-  save_to_disk(lines, filename)
+  if filename then
+    save_to_disk(lines, filename)
+  end
 end
 
 function propagate_to_drawings(x,y, button)
@@ -477,6 +479,9 @@ function love.textinput(t)
   if love.mouse.isDown('1') then return end
   if in_drawing() then return end
   lines[#lines] = lines[#lines]..t
+  if filename then
+    save_to_disk(lines, filename)
+  end
 end
 
 function keychord_pressed(chord)