diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Bit.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Bit.cs index 1fd615319b..f9ee97935d 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Bit.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Bit.cs @@ -1,4 +1,5 @@ -namespace BizHawk.Client.Common +using System; +namespace BizHawk.Client.Common { public class BitLuaLibrary : LuaLibraryBase { @@ -17,6 +18,7 @@ "rol", "ror", "rshift", + "check", }; } } @@ -62,5 +64,11 @@ { return (uint)(LuaInt(val) >> LuaInt(amt)); } + + public static bool bit_check(object num, object pos) + { + var value = Convert.ToInt64(LuaLong(num)); + return (value & (1 << (int)(LuaInt(pos)))) != 0; + } } }