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.
This commit is contained in:
parent
06ad5c4e8c
commit
6e54ad55d9
2
file.lua
2
file.lua
|
@ -37,7 +37,7 @@ end
|
||||||
|
|
||||||
function save_to_disk(State)
|
function save_to_disk(State)
|
||||||
local outfile = App.open_for_writing(State.filename)
|
local outfile = App.open_for_writing(State.filename)
|
||||||
if outfile == nil then
|
if not outfile then
|
||||||
error('failed to write to "'..State.filename..'"')
|
error('failed to write to "'..State.filename..'"')
|
||||||
end
|
end
|
||||||
for _,line in ipairs(State.lines) do
|
for _,line in ipairs(State.lines) do
|
||||||
|
|
|
@ -45,7 +45,7 @@ end
|
||||||
|
|
||||||
function save_to_disk(State)
|
function save_to_disk(State)
|
||||||
local outfile = App.open_for_writing(App.save_dir..State.filename)
|
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..'"')
|
error('failed to write to "'..State.filename..'"')
|
||||||
end
|
end
|
||||||
for _,line in ipairs(State.lines) do
|
for _,line in ipairs(State.lines) do
|
||||||
|
|
Loading…
Reference in New Issue