SpaceTown-Developers / Lemon-Gate

Expression Advanced a Lua sub language.
Other
15 stars 5 forks source link

Problem with teams() #197

Closed guillaume-dorczynski closed 10 years ago

guillaume-dorczynski commented 10 years ago

Previously I was able to do that:

foreach ( number Team : teams() )
{
    print( Team )
}

Now since you added arrays, teams() doesn't return a table but an array of table. so this code produce an error:

sv: uncatched exception 'array' in main thread. at Line 71 Char 12
sv: Msg: Invalid foreach loop, value type missmatches array type.

It may be a mistake, or it may be intentional but in this case I have no idea how to iterate these. This print nothing:

foreach ( table Team : teams() )
{
    printTable( Team )
}
Orzlar commented 10 years ago
for(number X = 1;X <=#teams()+1;X++){
    print(X)    
}

this prints 1. so confirmed I guess..

h3xcat commented 10 years ago

The issue is with the table arrays. When I was testing gmatch() in lemongate and set return type to table arrays, it gave similar errors. When I changed gmatch() return type to regular tables it worked perfectly.

Rusketh commented 10 years ago

This function was never converted properly, it will be fixed in next commit.