Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Assets/XLua/Src/CopyByValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions Assets/XLua/Src/Editor/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,7 @@ public static void GetGenConfig(IEnumerable<Type> check_types)

static Dictionary<Type, int> type_size = new Dictionary<Type, int>()
{
{ typeof(bool), 1 },
{ typeof(byte), 1 },
{ typeof(sbyte), 1 },
{ typeof(short), 2 },
Expand Down