If we have to add a condition anyway, might as well do the simplest possible thing.
SGPI6HF2XIOCLOYRPVXSKVGFWAAZWEFBEGZX5RYGHCPXLG6W6SSQC
local line_reader = line:gmatch('[^'..Metadata_separator..']+')
--? local line_reader = line:gmatch('[^\x1e]*')
line_info.data = line_reader()
line_info.data2 = line_reader()
print(line_info.data, line_info.data2)
print(line_info.data == nil, line_info.data2 == nil)
print(type(line_info.data), type(line_info.data2))
-- works
--? for data, data2 in line:gmatch('([^\x1e]*)\x1e([^\x1e]*)') do
--? print(data)
--? print(data2)
--? print(data2 == nil)
--? print(type(data2))
--? print(#data2)
--? end
--? for data in line:gmatch('[^\x1e]+') do
--? print(data)
--? print(data == nil)
--? print(type(data))
--? print(#data)
--? end
if line:find(Metadata_separator) then
_, _, line_info.data, line_info.data2 = line:find('([^'..Metadata_separator..']*)'..Metadata_separator..'([^'..Metadata_separator..']*)')
else
line_info.data = line
end
table.insert(result, {data=line})
local line_info = {}
if line:find(Metadata_separator) then
_, _, line_info.data, line_info.data2 = line:find('([^'..Metadata_separator..']*)'..Metadata_separator..'([^'..Metadata_separator..']*)')
else
line_info.data = line
end
table.insert(result, line_info)