Skip to content

Commit c6d0d4d

Browse files
authored
Merge branch 'main' into General-Iteration-#2
2 parents 26eb132 + d5b0881 commit c6d0d4d

File tree

4 files changed

+57
-51
lines changed

4 files changed

+57
-51
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 }

content/en-us/luau/stacks.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ function Stack.new()
2626
end
2727

2828
-- Check if the stack is empty
29-
function Stack:IsEmpty()
29+
function Stack:isEmpty()
3030
return #self._stack == 0
3131
end
3232

3333
-- Put a new value onto the stack
34-
function Stack:Push(value)
34+
function Stack:push(value)
3535
table.insert(self._stack, value)
3636
end
3737

3838
-- Take a value off the stack
39-
function Stack:Pop()
40-
if self:IsEmpty() then
39+
function Stack:pop()
40+
if self:isEmpty() then
4141
return nil
4242
end
4343

@@ -57,21 +57,21 @@ local s = Stack.new()
5757

5858
-- Change the stack Resulting stack Output
5959

60-
s:Push(1) -- {1}
60+
s:push(1) -- {1}
6161

62-
s:Push(5) -- {1, 5}
62+
s:push(5) -- {1, 5}
6363

64-
s:Push(10) -- {1, 5, 10}
64+
s:push(10) -- {1, 5, 10}
6565

66-
print(s:Pop()) -- {1, 5} 10
66+
print(s:pop()) -- {1, 5} 10
6767

68-
print(s:Pop()) -- {1} 5
68+
print(s:pop()) -- {1} 5
6969

70-
s:Push(20) -- {1, 20}
70+
s:push(20) -- {1, 20}
7171

72-
print(s:Pop()) -- {1} 20
72+
print(s:pop()) -- {1} 20
7373

74-
print(s:Pop()) -- {} 1
74+
print(s:pop()) -- {} 1
7575
```
7676

7777
<Alert severity="warning">

content/en-us/luau/tables.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ To create a dictionary table, define each **key** followed by `=` and the **valu
141141

142142
```lua
143143
local testDictionary = {
144-
FruitName = "Lemon",
145-
FruitColor = "Yellow",
146-
Sour = true
144+
fruitName = "Lemon",
145+
fruitColor = "Yellow",
146+
sour = true
147147
}
148148
```
149149

@@ -153,7 +153,7 @@ The keys for dictionaries can be numbers, strings, and objects. For example, a k
153153
local part = Instance.new("Part")
154154

155155
local testDictionary = {
156-
PartType = "Block",
156+
partType = "Block",
157157
[part] = true
158158
}
159159
```
@@ -166,11 +166,11 @@ To read from a dictionary, add a pair of brackets after its reference and specif
166166
local part = Instance.new("Part")
167167

168168
local testDictionary = {
169-
PartType = "Block",
169+
partType = "Block",
170170
[part] = true
171171
}
172172
-- Include quotes for string keys
173-
print(testDictionary["PartType"]) -- Block
173+
print(testDictionary["partType"]) -- Block
174174
-- Omit quotes for non-string keys
175175
print(testDictionary[part]) -- true
176176
```
@@ -181,20 +181,20 @@ To define or rewrite the value of a new or existing dictionary key, declare the
181181

182182
```lua
183183
local testDictionary = {
184-
FruitName = "Lemon",
185-
Sour = true
184+
fruitName = "Lemon",
185+
sour = true
186186
}
187187

188188
-- Change value of existing keys
189-
testDictionary["FruitName"] = "Cherry"
190-
testDictionary["Sour"] = false
189+
testDictionary["fruitName"] = "Cherry"
190+
testDictionary["sour"] = false
191191

192192
-- Insert new key-value pair
193-
testDictionary["FruitCount"] = 10
193+
testDictionary["fruitCount"] = 10
194194

195-
print(testDictionary["FruitName"]) -- Cherry
196-
print(testDictionary["Sour"]) -- false
197-
print(testDictionary["FruitCount"]) -- 10
195+
print(testDictionary["fruitName"]) -- Cherry
196+
print(testDictionary["sour"]) -- false
197+
print(testDictionary["fruitCount"]) -- 10
198198
```
199199

200200
### Iterating over Dictionaries
@@ -203,19 +203,19 @@ To iterate over a dictionary, use the global `pairs()` function in a `for` loop:
203203

204204
```lua
205205
local testDictionary = {
206-
FruitName = "Lemon",
207-
FruitColor = "Yellow",
208-
Sour = true
206+
fruitName = "Lemon",
207+
fruitColor = "Yellow",
208+
sour = true
209209
}
210210

211211
for key, value in pairs(testDictionary) do
212212
print(key, value)
213213
end
214214

215215
--[[ Resulting output:
216-
FruitName Lemon
217-
Sour true
218-
FruitColor Yellow
216+
fruitName Lemon
217+
sour true
218+
fruitColor Yellow
219219
]]
220220
```
221221

@@ -229,19 +229,19 @@ To remove or erase a key-value pair from a dictionary, set its value for a key t
229229

230230
```lua
231231
local testDictionary = {
232-
FruitName = "Lemon",
233-
FruitColor = "Yellow",
234-
Sour = true
232+
fruitName = "Lemon",
233+
fruitColor = "Yellow",
234+
sour = true
235235
}
236236

237-
testDictionary["Sour"] = nil
237+
testDictionary["sour"] = nil
238238

239239
for key, value in pairs(testDictionary) do
240240
print(key, value)
241241
end
242242
--[[ Resulting output:
243-
FruitName Lemon
244-
FruitColor Yellow
243+
fruitName Lemon
244+
fruitColor Yellow
245245
]]
246246
```
247247

content/en-us/reference/engine/enums/RollOffMode.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,26 @@ items:
1515
- name: Inverse
1616
summary: |
1717
Volume attenuates from `Class.Sound.RollOffMinDistance` in an inverse
18-
manner. This option mirrors how sounds attenuate in the real world.
18+
manner, mirroring how sounds attenuate in the real world.
19+
This is done through `Class.Sound.RollOffMinDistance`/`distance`,
20+
where `distance` is the `Datatype.Vector3.Magnitude` between the audio source and the audio listener.
1921
value: 0
2022
tags: []
2123
deprecation_message: ''
2224
- name: Linear
2325
summary: |
2426
Volume attenuates between `Class.Sound.RollOffMinDistance` and
2527
`Class.Sound.RollOffMaxDistance` with a linear relationship.
28+
This is done through (`Class.Sound.RollOffMaxDistance`/`distance`)/(`Class.Sound.RollOffMaxDistance`-`Class.Sound.RollOffMinDistance`),
29+
where `distance` is the `Datatype.Vector3.Magnitude` between the audio source and the audio listener.
2630
value: 1
2731
tags: []
2832
deprecation_message: ''
2933
- name: LinearSquare
3034
summary: |
3135
Volume attenuates between `Class.Sound.RollOffMinDistance` and
3236
`Class.Sound.RollOffMaxDistance` with a linear squared relationship.
37+
This is done through squaring `Linear`.
3338
value: 2
3439
tags: []
3540
deprecation_message: ''
@@ -38,6 +43,7 @@ items:
3843
A hybrid model which follows the `Inverse` model when close to
3944
`Class.Sound.RollOffMinDistance` and the `LinearSquare` model when close
4045
to `Class.Sound.RollOffMaxDistance`.
46+
This is done by taking the lesser of `Inverse` and `LinearSquare`.
4147
value: 3
4248
tags: []
4349
deprecation_message: ''

0 commit comments

Comments
 (0)