@@ -141,9 +141,9 @@ To create a dictionary table, define each **key** followed by `=` and the **valu
141141
142142``` lua
143143local 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
153153local part = Instance .new (" Part" )
154154
155155local 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
166166local part = Instance .new (" Part" )
167167
168168local 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
175175print (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
183183local 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
205205local testDictionary = {
206- FruitName = " Lemon" ,
207- FruitColor = " Yellow" ,
208- Sour = true
206+ fruitName = " Lemon" ,
207+ fruitColor = " Yellow" ,
208+ sour = true
209209}
210210
211211for key , value in pairs (testDictionary ) do
212212 print (key , value )
213213end
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
231231local 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
239239for key , value in pairs (testDictionary ) do
240240 print (key , value )
241241end
242242--[[ Resulting output:
243- FruitName Lemon
244- FruitColor Yellow
243+ fruitName Lemon
244+ fruitColor Yellow
245245]]
246246```
247247
@@ -280,7 +280,7 @@ To copy a table without any nested tables, Luau offers the `Library.table.clone(
280280local original = {
281281 key = " value" ,
282282 engine = " Roblox" ,
283- playerID = 505306092
283+ playerId = 505306092
284284}
285285
286286local clone = table .clone (original )
@@ -314,7 +314,7 @@ With the function in place, you can make a deep copy as follows:
314314local original = {
315315 key = " value" ,
316316 playerInfo = {
317- playerID = 505306092 ,
317+ playerId = 505306092 ,
318318 playerName = " PlayerName"
319319 },
320320 otherInfo = {
@@ -339,11 +339,11 @@ To freeze a table without any nested tables, Luau offers the `Library.table.free
339339local target = {
340340 key = " value" ,
341341 engine = " Roblox" ,
342- playerID = 505306092
342+ playerId = 505306092
343343}
344344
345345table .freeze (target )
346- target .playerID = 1 -- > attempt to modify a readonly table
346+ target .playerId = 1 -- > attempt to modify a readonly table
347347```
348348
349349### Deep Freezes
@@ -370,7 +370,7 @@ With the function in place, you can deep freeze a table as follows:
370370local target = {
371371 key = " value" ,
372372 playerInfo = {
373- playerID = 505306092 ,
373+ playerId = 505306092 ,
374374 playerName = " PlayerName"
375375 },
376376 otherInfo = {
@@ -381,5 +381,5 @@ local target = {
381381}
382382
383383deepFreeze (target )
384- target .playerInfo .playerID = 1 -- > attempt to modify a readonly table
384+ target .playerInfo .playerId = 1 -- > attempt to modify a readonly table
385385```
0 commit comments