From 853c82d111a13491ebc0460ece228cd27863fffb Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 26 Jan 2014 20:05:45 +0000 Subject: [PATCH] Lua Functions list - make params look pretty, including strongly typed variables when possible --- BizHawk.Client.Common/lua/EmuLuaLibrary.Emu.cs | 15 ++------------- BizHawk.Client.Common/lua/LuaDocumentation.cs | 18 +++++++++++------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Emu.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Emu.cs index 263682bfa0..36157cb814 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Emu.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Emu.cs @@ -63,20 +63,9 @@ namespace BizHawk.Client.Common "displayvsync", "Sets the display vsync property of the emulator" )] - public static void DisplayVsync(object boolean) + public static void DisplayVsync(bool enabled) { - var temp = boolean.ToString(); - if (!String.IsNullOrWhiteSpace(temp)) - { - if (temp == "0" || temp.ToLower() == "false") - { - Global.Config.VSyncThrottle = false; - } - else - { - Global.Config.VSyncThrottle = true; - } - } + Global.Config.VSyncThrottle = enabled; } [LuaMethodAttributes( diff --git a/BizHawk.Client.Common/lua/LuaDocumentation.cs b/BizHawk.Client.Common/lua/LuaDocumentation.cs index dc0443c19d..6fb04e78c9 100644 --- a/BizHawk.Client.Common/lua/LuaDocumentation.cs +++ b/BizHawk.Client.Common/lua/LuaDocumentation.cs @@ -83,17 +83,21 @@ namespace BizHawk.Client.Common list.Append('('); for (var i = 0; i < Parameters.Count; i++) { - var param = Parameters[i] - .Replace("System", String.Empty) - .Replace("Object", String.Empty) - .Replace(" ", String.Empty) - .Replace(".", String.Empty) - .Replace("LuaInterface", String.Empty); + var param = + Parameters[i].Replace("System", String.Empty) + .Replace("Object", String.Empty) + .Replace(" ", String.Empty) + .Replace(".", String.Empty) + .Replace("LuaInterface", String.Empty) + .Replace("Boolean", "bool ") + .Replace("String", "string ") + .Replace("LuaTable", "table ") + .Replace("LuaFunction", "func "); list.Append(param); if (i < Parameters.Count - 1) { - list.Append(','); + list.Append(", "); } }