forgot this.

This commit is contained in:
zhurengong
2022-04-19 19:01:10 +08:00
parent 1b0c865459
commit 592492a56f
@@ -9,6 +9,7 @@ using Microsoft.CodeAnalysis;
using System.Runtime.Loader; using System.Runtime.Loader;
using System.Reflection.PortableExecutable; using System.Reflection.PortableExecutable;
using System.Reflection.Metadata; using System.Reflection.Metadata;
using MoonSharp.Interpreter;
namespace Barotrauma namespace Barotrauma
{ {
@@ -97,7 +98,11 @@ namespace Barotrauma
if (runner != null) if (runner != null)
{ {
var method = runner.GetType().GetMethod("Run", BindingFlags.Public | BindingFlags.Instance); var method = runner.GetType().GetMethod("Run", BindingFlags.Public | BindingFlags.Instance);
if (method != null) scriptResilt = method.Invoke(runner, null); if (method != null)
{
scriptResilt = method.Invoke(runner, null);
foreach (var type in assembly.GetTypes()) { UserData.UnregisterType(type, true); }
}
else LuaCsSetup.PrintCsError("Script Error - no run method detected"); else LuaCsSetup.PrintCsError("Script Error - no run method detected");
} }
else LuaCsSetup.PrintCsError("Script Error - no runner class detected"); else LuaCsSetup.PrintCsError("Script Error - no runner class detected");