Ensure LuaValues are disposed.

Adding in these missing calls prevents these instances from having to be finalized.
This commit is contained in:
RoosterDragon
2015-12-23 16:04:58 +00:00
parent 387d0d0e3f
commit 6ab6d774a7
11 changed files with 184 additions and 142 deletions

View File

@@ -28,12 +28,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns a table of players filtered by the specified function.")]
public Player[] GetPlayers(LuaFunction filter)
{
return Context.World.Players
.Where(p =>
{
using (var f = filter.Call(p.ToLuaValue(Context)))
return f.First().ToBoolean();
}).ToArray();
return FilteredObjects(Context.World.Players, filter).ToArray();
}
}
}