Skip to content

Commit b68bf3e

Browse files
authored
Update names to match convention
1 parent 8ada24b commit b68bf3e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

content/en-us/luau/queues.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,20 @@ function Queue.new<T>(): Queue<T>
5858
end
5959

6060
-- Check if the queue is empty
61-
function Queue.IsEmpty<T>(self: Queue<T>)
61+
function Queue.isEmpty<T>(self: Queue<T>)
6262
return self._first > self._last
6363
end
6464

6565
-- Add a value to the queue
66-
function Queue.Enqueue<T>(self: Queue<T>, value: T)
66+
function Queue.enqueue<T>(self: Queue<T>, value: T)
6767
local last = self._last + 1
6868
self._last = last
6969
self._queue[last] = value
7070
end
7171

7272
-- Remove a value from the queue
73-
function Queue.Dequeue<T>(self: Queue<T>): T
74-
if self:IsEmpty() then
73+
function Queue.dequeue<T>(self: Queue<T>): T
74+
if self:isEmpty() then
7575
error("Cannot dequeue from empty queue")
7676
end
7777

@@ -96,27 +96,27 @@ local Queue = require(ReplicatedStorage:WaitForChild("Queue"))
9696
local myQueue = Queue.new()
9797

9898
-- Add some values to the queue
99-
myQueue:Enqueue(5)
100-
myQueue:Enqueue(10)
101-
myQueue:Enqueue(15)
99+
myQueue:enqueue(5)
100+
myQueue:enqueue(10)
101+
myQueue:enqueue(15)
102102

103103
-- myQueue = { 5, 10, 15 }
104104

105105
-- Remove one value from the queue
106-
local first = myQueue:Dequeue()
106+
local first = myQueue:dequeue()
107107
print("The first value added to the queue was", first)
108108

109109
-- myQueue = { 10, 15 }
110110

111111
-- Add more values to the queue
112-
myQueue:Enqueue(20)
113-
myQueue:Enqueue(25)
114-
myQueue:Enqueue(30)
112+
myQueue:enqueue(20)
113+
myQueue:enqueue(25)
114+
myQueue:enqueue(30)
115115

116116
-- myQueue = { 10, 15, 20, 25, 30 }
117117

118118
-- Remove another value from the queue
119-
local second = myQueue:Dequeue()
119+
local second = myQueue:dequeue()
120120
print("The second value added to the queue was", second)
121121

122122
-- myQueue = { 15, 20, 25, 30 }

0 commit comments

Comments
 (0)