Lua reading yad multiline text data.

8 views
Skip to first unread message

Jon Cooper

unread,
Jun 3, 2026, 7:56:54 PM (6 days ago) Jun 3
to yad-common
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. 

Jon Cooper

unread,
Jun 3, 2026, 8:37:31 PM (6 days ago) Jun 3
to yad-common
For info, this was solved by another group. I need double slash in the search pattern. 
Reply all
Reply to author
Forward
0 new messages