From 662096d98fa5221e79c770d66e332d656a85ee8d Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 16 May 2022 18:44:17 -0700 Subject: [PATCH] couple of bugfixes to file-handling --- main.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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