From d54e53d329a440d2beb43b6729630e29782e3e17 Mon Sep 17 00:00:00 2001 From: pjgat09 Date: Sat, 19 Dec 2015 00:01:06 -0500 Subject: [PATCH] Lua forms.setproperty: Convert the passed value to an enum if applicable --- .../tools/Lua/Libraries/EmuLuaLibrary.Forms.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Forms.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Forms.cs index 6b88687cc0..e9be4da0e9 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Forms.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Forms.cs @@ -482,6 +482,10 @@ namespace BizHawk.Client.EmuHawk { if (form.Handle == ptr) { + if (form.GetType().GetProperty(property).PropertyType.IsEnum) + { + value = Enum.Parse(form.GetType().GetProperty(property).PropertyType, value.ToString(), true); + } form .GetType() .GetProperty(property) @@ -493,6 +497,10 @@ namespace BizHawk.Client.EmuHawk { if (control.Handle == ptr) { + if (control.GetType().GetProperty(property).PropertyType.IsEnum) + { + value = Enum.Parse(control.GetType().GetProperty(property).PropertyType, value.ToString(), true); + } control .GetType() .GetProperty(property)