s:gmatch(s) docs:
runs string.gmatch(S, S2) and returns the captures in an array
s:gmatch(s,n) docs:
runs string.gmatch(S, S2, N) and returns the captures in an array
Test code:
@outputs Str:string [Gmatch,TypeIDs]:table
Str = "Ceca"
Gmatch = Str:gmatch("[0-9A-Fa-f][0-9A-Fa-f]")
#[
1:
1 = Ce
2:
1 = ca
]#
printTable(Gmatch)
print("____________________")
TypeIDs = Gmatch:typeids()
#[
1 = r
2 = r
]#
printTable(TypeIDs)
# So, it is an array? Let's check.
foreach (Index, Value:array = Gmatch)
{
print(_HUD_PRINTTALK, Index, Value) # Nothing.
}
# Nope. Nothing happened.
# Perhaps it is a table?
foreach (Index, Value:table = Gmatch)
{
print(_HUD_PRINTTALK, Index, Value) # Nothing.
}
# Damn it Divran.
Output:
1:
1 = Ce
2:1 = ca
1 = r
2 = r
Edit:
And here is a screenshot of what E2 Helper says, table:

On each iteration, the results are stored in an array, and added to a table. The reason you're not getting any output is because foreach doesn't loop through numeric indexes for tables.
Use
for(I=1,Result:count()) {
#whatever
}
EDIT: the only problem here is the documentation which says "returns [...] in an array" when it should say table
So, there comes "inefficient" for-loop to save the party xD
for loops are the most efficient, what are you talking about. You should only use foreach when you don't have any other choice.
They're efficient in terms of Lua, in E2 they use a lot more ops because of running the getters on the table
Right. But, why it says that they return a table in E2 Helper?! It is confusing..
Because they do return a table, within that table are arrays of all the matches
So, there comes "inefficient" for-loop to save the party xD
What, you expected iterators? #PythonToTheRescue
oh shit there's a tab instead of 4 spaces and now my program does something different
Okay, now that we had some laugh in here, and figured what was wrong..
_Just_ correct the docs, along with other hundred(s) with confusing/invalid docs.
So, I think I should close this issue or perhaps not?
or rename it to "blahblah is documented wrong"
Sorry about "backstroke bot", it had bugged out at some point...
@Divran Lets reopen this.
Most helpful comment
oh shit there's a tab instead of 4 spaces and now my program does something different