I'll have to play with it when I get home here in a few. Syntax is all correct and I've used that exact split and pattern functions in other code without that error so it should work. I'm thinking you probably missed a " or something somewhere.
You can try this but I don't think it will make much difference.
local tTable = {}
local user = ""
local message = ""
function pattern(text,pattern,start)
return string.sub(text,string.find(text,pattern,start)) end
function split(string)
local sep = {}
local done = false
local count,prevVars,tmp = 0,0,0
string = string..",|"
while not done do
count = count + 1
tmp = pattern(string,"[^,]+",count+prevVars)
if tmp == "|" then done = true return sep end
prevVars = prevVars + tmp:len()
table.insert(sep,count,tmp)
end
return sep
end
local id, msg, distance = rednet.receive()
tTable = split(msg)
user = tTable[1]
message = tTable[2]
print(user.." > "..message)
I've tested both of the codes and they both work. I get no errors. You have to have a typo in the code somewhere.