If we have a string in Lua with a new line in it like "jim\njoe" we can split it into smaller strings for each line:
textdata="jim\njoe"
for line in string.gmatch(textdata,"[^\n]+") do print(line) end
We get:
jim
joe
Now, if I read multiline text from a yad form, I cannot split the string into lines.
options="yad --form --field=\"Multiline text.:TXT\" \"jim\njoe\""
yadform=io.popen(options)
for l in yadform:lines() do for line in string.gmatch(l,"[^\n]+") do print(line) end end
yadform:close()
It gives me:
jim\njoe|
i.e. the string gmatch thing is not splitting the text at the "\n"
I need to be able to split the string wherever there is a "\n" so any help much apprecieated. Thank you.