Tested each sample.
This commit is contained in:
parent
e394956cde
commit
52ac60af81
27 changed files with 789 additions and 163 deletions
15
gem/ex5.lua
Normal file
15
gem/ex5.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
function source.empty(err)
|
||||
return function()
|
||||
return nil, err
|
||||
end
|
||||
end
|
||||
|
||||
function source.file(handle, io_err)
|
||||
if handle then
|
||||
return function()
|
||||
local chunk = handle:read(20)
|
||||
if not chunk then handle:close() end
|
||||
return chunk
|
||||
end
|
||||
else return source.empty(io_err or "unable to open file") end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue