Fixed IDisposable implementation and usage.
- Implement IDisposable interface correctly, with sealed classes where possible for simplicity. - Add using statement around undisposed local variables.
This commit is contained in:
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
public object Create(ActorInitializer init) { return new LuaScriptInterface(this); }
|
||||
}
|
||||
|
||||
public class LuaScriptInterface : IWorldLoaded, ITick
|
||||
public sealed class LuaScriptInterface : IWorldLoaded, ITick, IDisposable
|
||||
{
|
||||
World world;
|
||||
SpawnMapActors sma;
|
||||
@@ -90,6 +90,11 @@ namespace OpenRA.Mods.RA.Scripting
|
||||
context.InvokeLuaFunction("Tick");
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
context.Dispose();
|
||||
}
|
||||
|
||||
[LuaGlobal]
|
||||
public object New(string typeName, LuaTable args)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user