So I'm trying to make a program that decodes a string value, to find certain blocks of text and do things with it. I'm having but one problem, and I feel like it's easy and I'm just missing something. Here are my attempts:
local Source = "Testing <hello world> Ended message 1 <test 2> Ended second message"
local function CompileText(fromSource)
for s in string.gmatch(fromSource, "<[%a%s%p%d]+>") do
print(s) -- should print '<test 2>' and '<hello world> ' on TWO different lines
end
end
CompileText(Source)
So basically, I'm trying to make it so that the for loop will run for each block that exists, but for some reason it just prints the entire line of text, even though there are two formatted codes in the string ( and <test 2>).
I put the [%a%s%p%d]+ in the string pattern so that text in between the < > symbols won't be ignored, or interfere with the process (it'll just be normal text). This is what I'm trying to get it to print:
<hello world>
<test 2>
If anyone could help me with this, I'd be very grateful.

1 comment
"<.->"