aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index da70464..6c55905 100644
--- a/init.lua
+++ b/init.lua
@@ -1,5 +1,8 @@
local function file_exists(path)
- local f <close> = io.open(path)
+ local f = io.open(path)
+ if f ~= nil then
+ debug.getmetatable(f)["__gc"] = io.close
+ end
return f ~= nil
end