From 6e54ad55d98ff041db15a1a1157e493d76776dfc Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 30 Aug 2023 23:52:25 -0700 Subject: [PATCH] yet another set of bugfixes The key API change I'd underestimated: opening a file used to return nil on failure, and now returns false. --- file.lua | 2 +- source_file.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/file.lua b/file.lua index 62b075e..228f1f3 100644 --- a/file.lua +++ b/file.lua @@ -37,7 +37,7 @@ end function save_to_disk(State) local outfile = App.open_for_writing(State.filename) - if outfile == nil then + if not outfile then error('failed to write to "'..State.filename..'"') end for _,line in ipairs(State.lines) do diff --git a/source_file.lua b/source_file.lua index b0e26eb..dbb6f95 100644 --- a/source_file.lua +++ b/source_file.lua @@ -45,7 +45,7 @@ end function save_to_disk(State) local outfile = App.open_for_writing(App.save_dir..State.filename) - if outfile == nil then + if not outfile then error('failed to write to "'..State.filename..'"') end for _,line in ipairs(State.lines) do