lua how split string by another string code example
Example: lua string.split
function Split(s, delimiter)
result = {};
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
split_string = Split("Hello World!", " ")
-- split_string[1] = "Hello"
-- split_string[2] = "World!"