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
|
end
|
||||||
|
|
||||||
function App.open_for_reading(filename)
|
function App.open_for_reading(filename)
|
||||||
return {
|
if App.filesystem[filename] then
|
||||||
lines = function(self)
|
return {
|
||||||
return App.filesystem[filename]:gmatch('[^\n]+')
|
lines = function(self)
|
||||||
end,
|
return App.filesystem[filename]:gmatch('[^\n]+')
|
||||||
close = function(self)
|
end,
|
||||||
end,
|
close = function(self)
|
||||||
}
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function App.run_tests()
|
function App.run_tests()
|
||||||
|
|
Loading…
Reference in New Issue