LogoAntiRaid

@antiraid-ext/lockdowns/priorityset

API reference for @antiraid-ext/lockdowns/priorityset

@antiraid-ext/lockdowns/priorityset

Types

PrioritySet

@internal Lockdown only

Priority sets

PrioritySet can add elements with its priority with all priorities being saved.

When removing an element, the elements prior priority will be set.

Usage notes

  1. The elements stored must be hashable (e.g. strings, numbers, etc.).
Raw Type
--- @internal Lockdown only
--- Priority sets
---
--- PrioritySet can add elements with its priority with all priorities being saved.
--- When removing an element, the elements prior priority will be set.
---
--- **Usage notes**
---
--- 1. The elements stored must be hashable (e.g. strings, numbers, etc.).
type PrioritySet<K> = {
	--- Adds an element to the priority set with priority
	add: (element: K, priority: number) -> (),

	--- Removes an element from the priority set with priority
	remove: (element: K, priority: number) -> (),

	--- Returns the highest priority given element
	highest_priority: (element: K) -> number?,

	--- Returns the lowest priority given element
	lowest_priority: (element: K) -> number?,

	--- Returns if an element exists in the priority set or not
	exists: (element: K) -> boolean,

	-- Metatable
	__iter: (self: PrioritySet<K>) -> () -> (K?, number?)
}
PropTypeDescription
add
(element: K, priority: number) -> ()
Adds an element to the priority set with priority
remove
(element: K, priority: number) -> ()
Removes an element from the priority set with priority
highest_priority
(element: K) -> number?
Returns the highest priority given element
lowest_priority
(element: K) -> number?
Returns the lowest priority given element
exists
(element: K) -> boolean
Returns if an element exists in the priority set or not
__iter
(self) -> () -> (K?, number?)
-

Functions

PrioritySet

Function Signature
function PrioritySet<K>() -> PrioritySet<K> end

Generics

K

This generic is unconstrained and can be any type

Returns

ret1

PrioritySet<K>

Last updated on