Hi, all!
I have string "{100}Hello, world! {45}How are you?". How I can this string split into two arrays with parameters, i.e. in the end I got array:
ar = {
{100, "Hello, world! "},
{45, "How are you?"}
}
I make script:
ar = {}
s = "{100}Hello, world! {45}How are you?"
for k, v in string.gmatch(s, "({%d+})(%w+)") do
table.insert(ar, {k, v})
end
for k,v in ipairs(ar) do
outputChatBox("K: " .. k .. " V1: " ..v[1] .. " V2: " .. v[2])
end
as a result, I received
K: 1 V1: {100} V2: Hello
K: 2 V1: {45} V2: How
but that's not what I need
but I need this
K: 1 V1: 100 V2: Hello, world!
K: 2 V1: 45 V2: How are you?
Help me, please
p.s. sorry for bad english