Open SlenderFox opened 2 weeks ago
Similar to #490 I found that casting to Players before accessing fixes the error, however unlike #490 this doesn't feel like an unneeded workaround since the return type of FilteredArray is Any.
(<Player>FilteredArray(AllPlayers(), ArrayElement().A > 5)).B = 5;
I would like to see the error message improved to be more clear that this could be solved with type conversion.
The "semantic" way of doing a Filtered Array in OSTW is All Players().Filter(player => player.A > 5)
, though understandably this isn't well-known since the decompiler does not output this translation.
Attempting to set the player variable on a filtered array of players yields the error "No variable by the name of 'variable name' exists in the current scope."
e.g.
Error: "No variable by the name of 'B' exists in the current scope."
Of course in this example you could set the rule to be OnGoingPlayer, however in a different situation this wouldn't be possible/reasonable.