Module queue
Simple FIFO queue implementation.
Provides push/pop operations with optional maximum size.
Functions
| push (v) | Push a value onto the queue. |
| pop () | Pop the next value from the queue. |
| size () | Get the number of elements currently in the queue. |
| is_empty () | Check whether the queue is empty. |
Functions
- push (v)
-
Push a value onto the queue.
Parameters:
- v Value to add.
Returns:
-
boolean
True if the value was added, false if the queue is full.
- pop ()
-
Pop the next value from the queue.
Returns:
-
any
The next value, or nil if the queue is empty.
- size ()
-
Get the number of elements currently in the queue.
Returns:
-
number
- is_empty ()
-
Check whether the queue is empty.
Returns:
-
boolean