helper: file_exists

This commit is contained in:
Kartik K. Agaram 2022-08-23 15:04:30 -07:00
parent 019a829279
commit aeaa7d150c
1 changed files with 10 additions and 0 deletions

View File

@ -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)