Add ltn12.source.table()
This commit is contained in:
parent
6529598909
commit
8fee636309
4 changed files with 31 additions and 1 deletions
|
@ -128,6 +128,16 @@ function source.string(s)
|
|||
else return source.empty() end
|
||||
end
|
||||
|
||||
-- creates table source
|
||||
function source.table(t)
|
||||
base.assert('table' == type(t))
|
||||
local i = 0
|
||||
return function()
|
||||
i = i + 1
|
||||
return t[i]
|
||||
end
|
||||
end
|
||||
|
||||
-- creates rewindable source
|
||||
function source.rewind(src)
|
||||
base.assert(src)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue