make App.open_for_* look more like io.open
Now missing files will result in similar behavior: nil file handles.
This commit is contained in:
parent
b6f42ebf01
commit
019a829279
16
app.lua
16
app.lua
|
@ -302,13 +302,15 @@ function App.open_for_writing(filename)
|
|||
end
|
||||
|
||||
function App.open_for_reading(filename)
|
||||
return {
|
||||
lines = function(self)
|
||||
return App.filesystem[filename]:gmatch('[^\n]+')
|
||||
end,
|
||||
close = function(self)
|
||||
end,
|
||||
}
|
||||
if App.filesystem[filename] then
|
||||
return {
|
||||
lines = function(self)
|
||||
return App.filesystem[filename]:gmatch('[^\n]+')
|
||||
end,
|
||||
close = function(self)
|
||||
end,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function App.run_tests()
|
||||
|
|
Loading…
Reference in New Issue