this is hard to explain for me, i need a to create a 2d table according to how a string is inputted, the tables are created for each delimiter it finds in the string, first delimiter i use is "," - which creates a tables inside the current table index for each alphanumeric character it finds in the message, the second delimiter i use is "|" - it creates a new table, and every word before "," it finds after "|" will be put into the new table
heres what i have:
local function SortMessageToTable(Message, Delimiter)
local out = {}
for word in (Message .. Delimiter):gmatch("(%w-)" .. Delimiter) do
table.insert(out, word)
end
return out
end
local SortedMessage = SortMessageToTable(Message, "|")
for i = 1, #SortedMessage do
SortedMessage[i] = SortMessageToTable(SortedMessage[i], ",")
end
what i'm trying to get: input = "test1, test2 | test2, test1"
result = table1: {"test2", "test2"} table2: {"test1", "test1"}
what i want to be getting is = table1: {"test1", "test2"} table2: {"test2", "test1"}
for some reason it just gets the last word it finds before "|" and sets every field in the table index to it. does anyone know how to fix this? it would be very appreciated

1 comment
anyone?