about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-16 18:44:17 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-16 18:44:17 -0700
commit662096d98fa5221e79c770d66e332d656a85ee8d (patch)
treedbb68820bc2d2107e7eefb58db18d3b8f5824ef7
parent551985e383348a0544454030377262aad784055c (diff)
downloadlines.love-662096d98fa5221e79c770d66e332d656a85ee8d.tar.gz
couple of bugfixes to file-handling
-rw-r--r--main.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.lua b/main.lua
index 7cd410c..826dfc5 100644
--- a/main.lua
+++ b/main.lua
@@ -70,6 +70,7 @@ function love.filedropped(file)
   filename = file:getFilename()
   file:open('r')
   lines = load_from_file(file)
+  file:close()
 end
 
 function love.draw()
@@ -812,7 +813,7 @@ function math.dist(x1,y1, x2,y2) return ((x2-x1)^2+(y2-y1)^2)^0.5 end
 
 function load_from_disk(filename)
   local infile = io.open(filename)
-  local result = load_from_file(io.open(filename))
+  local result = load_from_file(infile)
   infile:close()
   return result
 end