Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

README.md

Queue.lua

Queue implementation for Lua and PICO-8
Inspired by Queue.js

Reference:

Queue:new()
Create a new queue

Queue:enqueue(value)
Add item to the queue

Queue:dequeue()
Retrieve item from the queue

Queue:peek()
Output the first item in queue

Queue:isEmpty()
Check if queue is empty

Queue:length()
Get Length of the queue

Example

local q = Queue:new()
  
q:enqueue(3)
q:enqueue(5)
q:enqueue(10) 
-- q = { 3, 5, 10 }

print(q:length()) --> 3
  
print(q:dequeue()) --> 3
print(q:dequeue()) --> 5
print(q:dequeue()) --> 10

print(q:isEmpty()) --> true

About

Queue implementation for Lua and PICO-8

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.