aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2023-08-13 18:55:34 +0200
committerMatěj Cepl <mcepl@cepl.eu>2023-08-13 18:55:34 +0200
commitcf5b93b1590ee707ee3d14eda1f9368aa404b689 (patch)
tree8da42eae75d6140327d13de97a7073ef67eabebd
parent9688caed346cdde5a5546f9a6c722eccf3b7ede1 (diff)
downloadvis-open_rej-cf5b93b1590ee707ee3d14eda1f9368aa404b689.tar.gz
Unfortunately Lua 5.3 (on Leap 15) doesn’t to-be-closed variables yet.
-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