replace Bytearray with FFI implementation
This commit is contained in:
@@ -99,7 +99,7 @@ static int pack(lua::State* L, const char* format, bool usetable) {
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
return lua::newuserdata<lua::LuaBytearray>(L, builder.build());
|
||||
return lua::create_bytearray(L, builder.build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +130,8 @@ static int count_elements(const char* format) {
|
||||
static int l_unpack(lua::State* L) {
|
||||
const char* format = lua::require_string(L, 1);
|
||||
int count = count_elements(format);
|
||||
auto bytes = lua::require_bytearray(L, 2);
|
||||
ByteReader reader(bytes);
|
||||
auto bytes = lua::bytearray_as_string(L, 2);
|
||||
ByteReader reader(reinterpret_cast<const ubyte*>(bytes.data()), bytes.size());
|
||||
bool bigEndian = false;
|
||||
|
||||
for (size_t i = 0; format[i]; i++) {
|
||||
|
||||
Reference in New Issue
Block a user