Class PoolByteArray
PoolByteArray metatype, wrapper for godot_pool_byte_array
Methods
PoolByteArray:append (...) | Alias for push_back. |
PoolByteArray:empty () | Returns true if the array is empty. |
PoolByteArray:extend (iterable) | Append all bytes of iterable at the end of Array. |
PoolByteArray:get (index) | Get the byte at index . |
PoolByteArray:get_string () | Returns a Lua string with the array's bytes. |
PoolByteArray:has (value) | Returns true if the array contains the given value . |
PoolByteArray:hex_encode () | Returns a hexadecimal representation of this array as a String. |
PoolByteArray:insert (index, byte) | Inserts a new element at a given position in the array. |
PoolByteArray:invert () | Reverses the order of the elements in the array. |
PoolByteArray:join ([delimiter=""]) | Returns a String with each element of the array joined with the given delimiter . |
PoolByteArray:push_back (...) | Append elements at the end of the array. |
PoolByteArray:read () | Returns the Read access for the array. |
PoolByteArray:remove (index) | Removes an element from the array by index. |
PoolByteArray:resize (size) | Sets the size of the array. |
PoolByteArray:safe_get (index) | Get the byte at index . |
PoolByteArray:safe_set (index, byte) | Set a new byte for index . |
PoolByteArray:set (index, byte) | Set a new byte for index . |
PoolByteArray:size () | Returns the size of the array. |
PoolByteArray:sort () | Sorts the elements of the array in ascending order. |
PoolByteArray:write () | Returns the Write access for the array. |
Static Functions
PoolByteArray:from (iterable) | Create a new array with the elements from iterable . |
Metamethods
PoolByteArray:__concat (a, b) | Concatenates values. |
PoolByteArray:__eq (a, b) | Equality operation |
PoolByteArray:__index (index) | Returns method named index or the result of safe_get(index - 1) . |
PoolByteArray:__ipairs () | Returns an iterator for array's elements, called by the idiom ipairs(array) . |
PoolByteArray:__len () | Alias for size. |
PoolByteArray:__new (...) | PoolByteArray constructor, called by the idiom PoolByteArray(...) . |
PoolByteArray:__newindex (index, value) | Alias for safe_set(index - 1, value) . |
PoolByteArray:__pairs () | Alias for __ipairs, called by the idiom pairs(array) . |
PoolByteArray:__tostring () | Returns a Lua string representation of this array. |
Class PoolByteArray.Read
Read:assign (other) | Assign a new Read access. |
Read:copy () | Create a copy of Read access. |
Read:destroy () | Destroy a Read access. |
Read:ptr () | Get Read access pointer. |
Class PoolByteArray.Write
Write:assign (other) | Assign a new Write access. |
Write:copy () | Create a copy of Write access. |
Write:destroy () | Destroy a Write access. |
Write:ptr () | Get Write access pointer. |
Methods
- PoolByteArray:append (...)
-
Alias for push_back.
Parameters:
- ...
See also:
- PoolByteArray:empty ()
-
Returns
true
if the array is empty.Returns:
-
bool
- PoolByteArray:extend (iterable)
-
Append all bytes of
iterable
at the end of Array.Parameters:
- PoolByteArray:get (index)
-
Get the byte at
index
. Unlike Lua tables, indices start at 0 instead of 1. For 1-based indexing, use the idiomarray[index]
instead.If
index
is invalid (index < 0
orindex >= size()
), the application will crash. For a safe version that returnsnil
ifindex
is invalid, use safe_get or the idiomarray[index]
instead.Parameters:
- index int
Returns:
-
int
See also:
- PoolByteArray:get_string ()
-
Returns a Lua string with the array's bytes.
Returns:
- PoolByteArray:has (value)
-
Returns true if the array contains the given
value
.Parameters:
- value byte
Returns:
-
bool
- PoolByteArray:hex_encode ()
-
Returns a hexadecimal representation of this array as a String.
Returns:
See also:
- PoolByteArray:insert (index, byte)
-
Inserts a new element at a given position in the array.
The position must be valid, or at the end of the array (
idx == size()
).Parameters:
- index int
- byte int
- PoolByteArray:invert ()
- Reverses the order of the elements in the array.
- PoolByteArray:join ([delimiter=""])
-
Returns a String with each element of the array joined with the given
delimiter
.Parameters:
- delimiter (default "")
Returns:
- PoolByteArray:push_back (...)
-
Append elements at the end of the array.
Parameters:
- ... Bytes to be appended
- PoolByteArray:read ()
-
Returns the Read access for the array.
Returns:
- PoolByteArray:remove (index)
-
Removes an element from the array by index.
Parameters:
- index int
- PoolByteArray:resize (size)
-
Sets the size of the array.
If the array is grown, reserves elements at the end of the array.
If the array is shrunk, truncates the array to the new size.
Parameters:
- size int
- PoolByteArray:safe_get (index)
-
Get the byte at
index
. Unlike Lua tables, indices start at 0 instead of 1. For 1-based indexing, use the idiomarray[index]
instead.The idiom
array[index]
also calls this method.Parameters:
- index int
Returns:
-
int
Or
-
nil
If index is invalid (
index < 0
orindex >= size()
)See also:
- PoolByteArray:safe_set (index, byte)
-
Set a new byte for
index
. Unlike Lua tables, indices start at 0 instead of 1. For 1-based indexing, use the idiomarray[index] = value
instead.If
index >= size()
, the array is resized first. The idiomarray[index] = value
also calls this method.Parameters:
- index int
- byte int
Raises:
Ifindex < 0
See also:
- PoolByteArray:set (index, byte)
-
Set a new byte for
index
. Unlike Lua tables, indices start at 0 instead of 1. For 1-based indexing, use the idiomarray[index] = value
instead.If
index
is invalid (index < 0
orindex >= size()
), the application will crash. For a safe approach that resizes ifindex >= size()
, use safe_set or the idiomarray[index] = value
instead.Parameters:
- index int
- byte int
See also:
- PoolByteArray:size ()
-
Returns the size of the array.
Returns:
-
int
- PoolByteArray:sort ()
- Sorts the elements of the array in ascending order.
- PoolByteArray:write ()
-
Returns the Write access for the array.
Returns:
Static Functions
self
and should be called directly as Array.static_function(...)
- PoolByteArray:from (iterable)
-
Create a new array with the elements from
iterable
.Parameters:
- iterable
If another PoolByteArray is passed, return a copy of it.
Otherwise, the new array is extended with
iterable
.
Returns:
See also:
Usage:
local array = PoolByteArray.from(some_table_or_other_iterable)
- iterable
If another PoolByteArray is passed, return a copy of it.
Otherwise, the new array is extended with
Metamethods
- PoolByteArray:__concat (a, b)
-
Concatenates values.
Parameters:
Returns:
- PoolByteArray:__eq (a, b)
-
Equality operation
Parameters:
- a Array, PoolByteArray, PoolIntArray, PoolRealArray, PoolStringArray, PoolVector2Array, PoolVector3Array, PoolColorArray or table
- b Array, PoolByteArray, PoolIntArray, PoolRealArray, PoolStringArray, PoolVector2Array, PoolVector3Array, PoolColorArray or table
Returns:
-
bool
- PoolByteArray:__index (index)
-
Returns method named
index
or the result ofsafe_get(index - 1)
.Like Lua tables, this uses 1-based indexing. For 0-based indexing, call get or safe_get directly.
Parameters:
- index
Returns:
-
Method or element or
nil
See also:
- PoolByteArray:__ipairs ()
-
Returns an iterator for array's elements, called by the idiom
ipairs(array)
.Returns:
- function
- PoolByteArray self
- int 0
Usage:
for i, byte in ipairs(array) do -- do something end
- PoolByteArray:__len ()
-
Alias for size.
Returns:
-
int
See also:
- PoolByteArray:__new (...)
-
PoolByteArray constructor, called by the idiom
PoolByteArray(...)
.Parameters:
- ... Initial elements, added with push_back
Returns:
- PoolByteArray:__newindex (index, value)
-
Alias for
safe_set(index - 1, value)
.Like Lua tables, indices start at 1. For 0-based indexing, call set or safe_set directly.
Parameters:
- index int
- value
See also:
- PoolByteArray:__pairs ()
-
Alias for __ipairs, called by the idiom
pairs(array)
.Returns:
- function
- PoolByteArray self
- int 0
See also:
- PoolByteArray:__tostring ()
-
Returns a Lua string representation of this array.
To get a string with the array contents, use get_string instead.
Returns:
See also:
Class PoolByteArray.Read
godot_pool_byte_array_read_access
.
- Read:assign (other)
-
Assign a new Read access.
Parameters:
- other Read
- Read:copy ()
-
Create a copy of Read access.
Returns:
- Read:destroy ()
- Destroy a Read access. Holding a valid access object may lock a PoolByteArray, so this method should be called manually when access is no longer needed.
- Read:ptr ()
-
Get Read access pointer.
Returns:
-
const uint8_t *
Class PoolByteArray.Write
godot_pool_byte_array_write_access
.
- Write:assign (other)
-
Assign a new Write access.
Parameters:
- other Write
- Write:copy ()
-
Create a copy of Write access.
Returns:
- Write:destroy ()
- Destroy a Write access. Holding a valid access object may lock a PoolByteArray, so this method should be called manually when access is no longer needed.
- Write:ptr ()
-
Get Write access pointer.
Returns:
-
uint8_t *