mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
improved Bytearray:fill method
This commit is contained in:
parent
3eac247a69
commit
2c72d33485
1 changed files with 7 additions and 2 deletions
|
|
@ -142,8 +142,13 @@ local function clear(self)
|
||||||
self.size = 0
|
self.size = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local function fill(self, byte)
|
local function fill(self, index, size, byte)
|
||||||
if self.size > 0 then
|
if index ~= nil and size ~= nil and size > 0 then
|
||||||
|
if index < 1 or index + size - 1 > self.size then
|
||||||
|
error("selected fill range is out of array bounds")
|
||||||
|
end
|
||||||
|
FFI.fill(self.bytes + index - 1, size, byte)
|
||||||
|
else
|
||||||
FFI.fill(self.bytes, self.size, byte)
|
FFI.fill(self.bytes, self.size, byte)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue