optimize data_buffer:put_bytes for Bytearray
This commit is contained in:
parent
4ce2f3edca
commit
212cc486d4
@ -72,9 +72,14 @@ function data_buffer:put_byte(byte)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function data_buffer:put_bytes(bytes)
|
function data_buffer:put_bytes(bytes)
|
||||||
|
if type(self.bytes) == 'table' then
|
||||||
for i = 1, #bytes do
|
for i = 1, #bytes do
|
||||||
self:put_byte(bytes[i])
|
self:put_byte(bytes[i])
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
self.bytes:append(bytes)
|
||||||
|
self.pos = self.pos + #bytes
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function data_buffer:put_single(single)
|
function data_buffer:put_single(single)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user