mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
optimize data_buffer:put_bytes for Bytearray
This commit is contained in:
parent
4ce2f3edca
commit
212cc486d4
1 changed files with 9 additions and 4 deletions
|
|
@ -72,9 +72,14 @@ function data_buffer:put_byte(byte)
|
|||
end
|
||||
|
||||
function data_buffer:put_bytes(bytes)
|
||||
for i = 1, #bytes do
|
||||
self:put_byte(bytes[i])
|
||||
end
|
||||
if type(self.bytes) == 'table' then
|
||||
for i = 1, #bytes do
|
||||
self:put_byte(bytes[i])
|
||||
end
|
||||
else
|
||||
self.bytes:append(bytes)
|
||||
self.pos = self.pos + #bytes
|
||||
end
|
||||
end
|
||||
|
||||
function data_buffer:put_single(single)
|
||||
|
|
@ -308,4 +313,4 @@ end
|
|||
|
||||
setmetatable(data_buffer, data_buffer)
|
||||
|
||||
return data_buffer
|
||||
return data_buffer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue