about summary refs log tree commit diff stats
path: root/file.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-08-23 15:50:01 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-08-23 15:50:01 -0700
commit39b2c849c415f8efe56e40fabf414a0799fb2145 (patch)
tree2da0da354da56acc08f3f6354ac79bd33bcfa795 /file.lua
parentd011c0ce325b69ed413666a5adb31156c1a26c41 (diff)
parent89222f86a0dc3dd774ce46afaa1ba791ed65dba9 (diff)
downloadview.love-39b2c849c415f8efe56e40fabf414a0799fb2145.tar.gz
Merge lines.love
Diffstat (limited to 'file.lua')
-rw-r--r--file.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/file.lua b/file.lua
index 94514b2..e95c14d 100644
--- a/file.lua
+++ b/file.lua
@@ -1,4 +1,14 @@
 -- primitives for saving to file and loading from file
+function file_exists(filename)
+  local infile = App.open_for_reading(filename)
+  if infile then
+    infile:close()
+    return true
+  else
+    return false
+  end
+end
+
 function load_from_disk(State)
   local infile = App.open_for_reading(State.filename)
   State.lines = load_from_file(infile)