you could use string.find to search for the position of your dividing character, then use string.sub to save the part before it to a variable or table (append the empty string to it (.."") to make sure new memory is allocated for it) then use string.sub to save the part after the divider to the same variable you were reading from again make sure new memory is allocated for it by appending the empty string.
repeat this until your variable holding the message does not contain the divider anymore. it now holds the last part of your message
I wrote a little testprogram for this
local argv = { ... }
local msg = argv[1]
local Table = {}
local index = 1
local divider = "-"
if msg ~= nil then
local pos = string.find(msg, divider)
while pos ~= nil do
Table[index] = string.sub(msg, 1, pos - 1)..""
index = index + 1
msg = string.sub(msg, pos + 1)
pos = string.find(msg, divider)
end
Table[index] = msg
for i = 1, index do
print(Table[i])
end
end
and after confirming it working by the program logic logic tested it with
testprog test-1-2-3
testprog test-1-2-3-
testprog -
testprog
the first works just fine
the second creates an empty string in the last table entry
the third creates a table with two empty entries
the fourth does nothing (obviously)