I think using a split function would help you more here. There are some implementations on
lua-users, and I'm pretty sure some people have created some string utilities around these forums.
Copied from lua-users:
function split(str, pat)
local t = {}
local fpat = "(.-)" .. pat
local last_end = 1
local s, e, cap = str:find(fpat, 1)
while s do
if s ~= 1 or cap ~= "" then
table.insert(t,cap)
end
last_end = e+1
s, e, cap = str:find(fpat, last_end)
end
if last_end <= #str then
cap = str:sub(last_end)
table.insert(t, cap)
end
return t
end
You could just split your string, then go through the table it returns and then rednet.send() the strings individually.
-- your split() implementation here
local str = 'Stuff, more stuff, even more stuff'
local splitTable = split(str)
for i=1, #splitTable do
rednet.send(1, splitTable[i])
end