diff --git a/Assets/XLua/Src/CopyByValue.cs b/Assets/XLua/Src/CopyByValue.cs index 037fa0134..ce273e2fc 100644 --- a/Assets/XLua/Src/CopyByValue.cs +++ b/Assets/XLua/Src/CopyByValue.cs @@ -31,6 +31,16 @@ public static bool UnPack(IntPtr buff, int offset, out byte field) { return LuaAPI.xlua_unpack_int8_t(buff, offset, out field); } + public static bool Pack(IntPtr buff, int offset, bool field) + { + return LuaAPI.xlua_pack_int8_t(buff, offset, field ? (byte)1 : (byte)0); + } + public static bool UnPack(IntPtr buff, int offset, out bool field) + { + bool ret = LuaAPI.xlua_unpack_int8_t(buff, offset, out byte tfield); + field = tfield != 0; + return ret; + } public static bool Pack(IntPtr buff, int offset, sbyte field) { return LuaAPI.xlua_pack_int8_t(buff, offset, (byte)field); diff --git a/Assets/XLua/Src/Editor/Generator.cs b/Assets/XLua/Src/Editor/Generator.cs index b20fa1d15..ffc685b66 100644 --- a/Assets/XLua/Src/Editor/Generator.cs +++ b/Assets/XLua/Src/Editor/Generator.cs @@ -1524,6 +1524,7 @@ public static void GetGenConfig(IEnumerable check_types) static Dictionary type_size = new Dictionary() { + { typeof(bool), 1 }, { typeof(byte), 1 }, { typeof(sbyte), 1 }, { typeof(short), 2 },