Skip to content

Commit

Permalink
more work
Browse files Browse the repository at this point in the history
  • Loading branch information
CasualPokePlayer committed Aug 18, 2022
1 parent be376b9 commit c41096a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/BizHawk.Client.Common/lua/NLuaTableHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public LuaTable ObjectToTable(object obj)
return ParseColor((int) (long) d, safe, logCallback);
case int i:
return Color.FromArgb(i);
case long l:
return Color.FromArgb((int)l);
case string s:
if (s[0] is '#' && (s.Length is 7 or 9))
{
Expand Down
2 changes: 1 addition & 1 deletion src/BizHawk.Client.Common/lua/NamedLuaFunction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public NamedLuaFunction(LuaFunction function, string theEvent, Action<string> lo
public void DetachFromScript()
{
new Lua().NewThread(out var thread);

// Current dir will have to do for now, but this will inevitably not be desired
// Users will expect it to be the same directly as the thread that spawned this callback
// But how do we know what that directory was?
Expand Down
6 changes: 0 additions & 6 deletions src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -629,12 +629,6 @@ public void ResumeScripts(bool includeFrameWaiters)
}
}

luaLibsImpl.RunScheduledDisposes();
foreach (var nlf in luaLibsImpl.RegisteredFunctions)
{
nlf.LuaFile.Thread.Dispose();
}

_messageCount = 0;
}

Expand Down
8 changes: 1 addition & 7 deletions src/BizHawk.Client.EmuHawk/tools/Lua/Win32LuaLibraries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,7 @@ public void SpawnAndSetFileThread(string pathToLoad, LuaFile lf)
}

public void ExecuteString(string command)
{
var func = _lua.LoadString(command, "main");
var state = _lua.NewThread(func, out _currThread);
state.Resume(state, 0);
}

public void RunScheduledDisposes() => _lua.Dispose();
=> _lua.DoString(command);

public (bool WaitForFrame, bool Terminated) ResumeScript(LuaFile lf)
{
Expand Down

0 comments on commit c41096a

Please sign in to comment.