mirror of
https://github.com/geoffleyland/lua-csv.git
synced 2024-11-23 01:34:19 +00:00
whoops. Fix up find's return values when we've hit the end of file. How did that work?
This commit is contained in:
parent
e18409d73f
commit
46e65775bf
13
lua/csv.lua
13
lua/csv.lua
@ -188,10 +188,15 @@ local function separated_values_iterator(file, parameters)
|
|||||||
-- more.
|
-- more.
|
||||||
if not first or last == #buffer then
|
if not first or last == #buffer then
|
||||||
local s = file:read(buffer_size)
|
local s = file:read(buffer_size)
|
||||||
-- if we read nothing from the file:
|
-- if we read nothing from the file...
|
||||||
-- - and first is nil, then we found nothing. This will return nil.
|
if not s then
|
||||||
-- - and last == #buffer, then the capture we found above is good.
|
if first then
|
||||||
if not s then return first, last, capture end
|
-- ...and last == #buffer, then the capture we found above is good.
|
||||||
|
return first - anchor_pos + 1, last - anchor_pos + 1, capture
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
buffer = buffer..s
|
buffer = buffer..s
|
||||||
else
|
else
|
||||||
return first - anchor_pos + 1, last - anchor_pos + 1, capture
|
return first - anchor_pos + 1, last - anchor_pos + 1, capture
|
||||||
|
Loading…
Reference in New Issue
Block a user