Set¶
Reference¶
- class Set¶
- module:
A set implementation with fast lookup and ordered iteration.
- _rm: dict[any, boolean]¶
?
- static new(values?)¶
Create a new set
- Parameters:
values? (
list[any]
) – List of initial values- Return type:
- add(value)¶
Add a value to the set
- Parameters:
value (
any
)
- remove(value)¶
Remove a value from the set
- Parameters:
value (
any
)
- removeIf(predicate)¶
Remove all elements matching a predicate
- Parameters:
predicate (
fun(any):boolean
)
- forEach(func)¶
Iterate over each element in the set
- Parameters:
func (
fun(any):boolean or nil
)
- intersection(other)¶
Get the intersection of this set and another
- size()¶
Get the number of elements in the set
- Return type:
number
- contains(value)¶
Check if set contains a value
- Parameters:
value (
any
)- Return type:
boolean
- toList()¶
Return all elements as a list
- Return type:
list[any]