a typesafe O(1) queue library for luau
All functions are listed in Methods
local queue = require(...)
local foo = queue.new()
foo:push("foo")
foo:push("bar")
foo:push("baz")
local popped = foo:pop()
print(popped) --> 'foo'
:push(value: T)
- Add value to queue.:pop()
- Remove the first value from queue and return it.:peek()
- Returns the first value from queue but does not remove it.:get(index: number?)
- If noindex
provided it will return the fullqueue
in table.:set(index: number, value: T)
- Sets thevalue
at givenindex
.:size()
- Returns the size of the queue.:clear()
- Clears the entire queue.