Skip to content

Home › Overview › Flux › Util

Queue ​

A queue that yields on pop until something is available.

Constructors: Queue.new

Types ​

Queue type ​

luau
type Queue<T> = typeof(setmetatable(
	{} :: {
		items: { T }, -- everything still waiting, front first
	},
	Queue
))

A first-in, first-out queue.

Functions ​

new ​

luau
Queue.new<T>(): Queue<T>

Creates an empty queue.

Methods ​

push since 1.1.0 ​

luau
Queue:push(item: any)

Adds item to the back of the queue.

pop Yields ​

luau
Queue:pop(): any

Removes the front item and returns it, waiting when the queue is empty.