@antiraid-ext/array
API reference for @antiraid-ext/array
@antiraid-ext/array
Functions
array
Create new array() function to allow easily creating arrays
This function sets the array_metatable as well
Function Signature
-- Create new array() function to allow easily creating arrays
--
-- This function sets the array_metatable as well
function array(...) end
Arguments
...
No type specified!!!
internalProtectedEquals
Function Signature
function internalProtectedEquals(o1, o2, ignore_mt, callList) end
Arguments
o1
No type specified!!!
o2
No type specified!!!
ignore_mt
No type specified!!!
callList
No type specified!!!
arraysEqual
Compares two objects for equality, including arrays and tables.
Function Signature
--- Compares two objects for equality, including arrays and tables.
---
---@param o1 any|table First object to compare
---@param o2 any|table Second object to compare
---@param ignore_mt boolean True to ignore metatables (a recursive function to tests tables inside tables)
function arraysEqual(o1, o2, ignore_mt) end
Arguments
o1
any|table First object to compare
No type specified!!!
o2
any|table Second object to compare
No type specified!!!
ignore_mt
boolean True to ignore metatables (a recursive function to tests tables inside tables)
No type specified!!!
toArray
Converts a value to an array.
If the value is already an array, it is returned as is with a special ``array_metatable`` set as its metatable.
If the value is not an array, it is wrapped in an array.
Function Signature
--- Converts a value to an array.
---
--- If the value is already an array, it is returned as is with a special \`\`array_metatable\`\` set as its metatable.
---
--- If the value is not an array, it is wrapped in an array.
function toArray<T>(a: T) -> T end
Generics
T
This generic is unconstrained and can be any type
Arguments
a
Returns
ret1
slice
Slices a table from `from` to `to`.
If `from` is nil, it defaults to 1. If `to` is nil, it defaults to the length of the table.
Returns a new table containing the sliced elements.
Errors if ``to > #arr`` or ``from < 1``
Function Signature
--- Slices a table from \`from\` to \`to\`.
---
--- If \`from\` is nil, it defaults to 1. If \`to\` is nil, it defaults to the length of the table.
--- Returns a new table containing the sliced elements.
---
--- Errors if \`\`to > #arr\`\` or \`\`from < 1\`\`
---
---@param arr table The table to slice
---@param from number? The starting index (1-based)
---@param to number? The ending index (1-based)
---@return table A new table containing the sliced elements
function slice<T>(arr: {T}, from: number?, to: number?) -> {T} end
Generics
T
This generic is unconstrained and can be any type
Arguments
arr
table The table to slice
{T}
from
number? The starting index (1-based)
This field is optional and may not be specified
to
number? The ending index (1-based)
This field is optional and may not be specified
Returns
table
A new table containing the sliced elements
{T}
Last updated on