set a value in the switchable lua library to indicate whether it's NLua or LuaInterface; effectively undo 8bc067cbbe
for LuaInterface
This commit is contained in:
parent
dce98db811
commit
afda5dbb62
|
@ -49,7 +49,8 @@
|
|||
public void Stop()
|
||||
{
|
||||
State = RunState.Disabled;
|
||||
Thread.GetTable("keepalives")[Thread] = null;
|
||||
if(NLua.Lua.WhichLua == "NLua")
|
||||
Thread.GetTable("keepalives")[Thread] = null;
|
||||
Thread = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public EmuLuaLibrary()
|
||||
{
|
||||
Docs = new LuaDocumentation();
|
||||
_lua["keepalives"] = _lua.NewTable();
|
||||
if(NLua.Lua.WhichLua == "NLua")
|
||||
_lua["keepalives"] = _lua.NewTable();
|
||||
}
|
||||
|
||||
public EmuLuaLibrary(IEmulatorServiceProvider serviceProvider)
|
||||
|
@ -177,8 +178,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
var content = File.ReadAllText(file);
|
||||
var main = lua.LoadString(content, "main");
|
||||
lua.Push(main); // push main function on to stack for subsequent resuming
|
||||
_lua.GetTable("keepalives")[lua] = 1;
|
||||
_lua.Pop();
|
||||
if (NLua.Lua.WhichLua == "NLua")
|
||||
{
|
||||
_lua.GetTable("keepalives")[lua] = 1;
|
||||
//this not being run is the origin of a memory leak if you restart scripts too many times
|
||||
_lua.Pop();
|
||||
}
|
||||
return lua;
|
||||
}
|
||||
|
||||
|
@ -186,7 +191,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_currThread = _lua.NewThread();
|
||||
_currThread.DoString(command);
|
||||
_lua.Pop();
|
||||
if (NLua.Lua.WhichLua == "NLua")
|
||||
_lua.Pop();
|
||||
}
|
||||
|
||||
public ResumeResult ResumeScript(Lua script)
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace NLua
|
|||
public class Lua : IDisposable
|
||||
{
|
||||
|
||||
public static readonly string WhichLua = "LuaInterface";
|
||||
|
||||
static string init_luanet =
|
||||
"local metatable = {} \n"+
|
||||
"local import_type = luanet.import_type \n"+
|
||||
|
|
|
@ -145,7 +145,7 @@
|
|||
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>..\..\references\x64\</OutputPath>
|
||||
<OutputPath>..\..\output\dll\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue