EDIT: My apologies, per usual, I wasn't as investigative enough. I found an appropriate function Nick wrote in this thread http://www.gammon.com.au/forum/bbshowpost.php?id=7669 that I was able to change around to suit my purposes. Problem solved. :)
--------------------------
Okay, so on this MUD I'm playing on you can type stats and see something like:
Str: 4 (+3) (+7) (+8)
Wis: 10 (+10) (+3)
etc...
The first number is your actual stat, and all the additions are bonuses from spells, equipment, stuff like that.
So I wrote a regexp to capture the first number and any number in parentheses after a + sign. I turned on repeat on same line and set it to color it to red to see what happened and every number got highlighted correctly. Then I made it so it would take every number and add it to a Lua table (stats.[Stat] = {#, #, etc}). But then I realized it would only add the first number in parentheses of every line, and I did some searching and found the thread about repeat on same line is just for coloring, it doesn't actually repeat the function for every match.
So now I'm a bit confused, I'm wondering if anyone has any ideas on how I can proceed to break the line down so it'll store on every instance of the match and not just the first? Should I continue using regexp? Any help appreciated, thanks.
--------------------------
Okay, so on this MUD I'm playing on you can type stats and see something like:
Str: 4 (+3) (+7) (+8)
Wis: 10 (+10) (+3)
etc...
The first number is your actual stat, and all the additions are bonuses from spells, equipment, stuff like that.
So I wrote a regexp to capture the first number and any number in parentheses after a + sign. I turned on repeat on same line and set it to color it to red to see what happened and every number got highlighted correctly. Then I made it so it would take every number and add it to a Lua table (stats.[Stat] = {#, #, etc}). But then I realized it would only add the first number in parentheses of every line, and I did some searching and found the thread about repeat on same line is just for coloring, it doesn't actually repeat the function for every match.
So now I'm a bit confused, I'm wondering if anyone has any ideas on how I can proceed to break the line down so it'll store on every instance of the match and not just the first? Should I continue using regexp? Any help appreciated, thanks.