lines.lua

 avatar
jbcooper
lua
6 days ago
631 B
8
Indexable
options="yad --form --field=\"Multiline text.:TXT\" \"jonathan jones\njoe noble\njim ananthranaranian\""
yadform=io.popen(options)
formdata=yadform:read("*all")

print("\n\n1st gmatch")
for line in string.gmatch(formdata,"(.-)\\n(.-)") do print(line) end

print("\n\n2nd gmatch")
for line in string.gmatch(formdata,"[^\\n]+") do print(line) end


function recsplit(formdata,start)
first,last=string.find(formdata,"\\n",start)
if first~=nil then
   print(string.sub(formdata,start,first-1))
   recsplit(formdata,last+1)
else
    print(string.sub(formdata,start))
end
end

print("\n\nhomebrew")
recsplit(formdata,1)

yadform:close()
Editor is loading...
Leave a Comment