mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
fix Bytearray.insert, Bytearray.remove
This commit is contained in:
parent
fb07c86ea6
commit
1ade910fa1
2 changed files with 12 additions and 2 deletions
|
|
@ -48,7 +48,8 @@ local function append(self, b)
|
|||
end
|
||||
|
||||
local function insert(self, index, b)
|
||||
if index == nil then
|
||||
if b == nil then
|
||||
b = index
|
||||
index = self.size + 1
|
||||
end
|
||||
if index <= 0 or index > self.size + 1 then
|
||||
|
|
@ -81,7 +82,7 @@ local function remove(self, index, elems)
|
|||
if index + elems > self.size then
|
||||
elems = self.size - index + 1
|
||||
end
|
||||
for i=index, self.size - elems do
|
||||
for i=index - 1, self.size - elems - 1 do
|
||||
self.bytes[i] = self.bytes[i + elems]
|
||||
end
|
||||
self.size = self.size - elems
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue