Skip to content

Commit 2c731ca

Browse files
authored
Merge branch 'main' into patch-2
2 parents 9332fa4 + 7f45faa commit 2c731ca

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

content/en-us/luau/tables.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,19 @@ local clone = table.clone(original)
291291
To copy a more complex table with nested tables inside it, you'll need to use a recursive function similar to the following:
292292

293293
```lua
294-
local function deepCopy(original)
294+
-- The function used for deep copying a table
295+
local function deepCopy(original)
296+
-- Define the new table for the copy
295297
local copy = {}
296-
for k, v in pairs(original) do
297-
if type(v) == "table" then
298-
v = deepCopy(v)
299-
end
300-
copy[k] = v
298+
299+
-- Loop through the original table to clone
300+
for key, value in original do
301+
-- If the type of the value is a table, deep copy it to the key (index)
302+
-- Else (or) the type isn't a table, assign the default value to the index instead
303+
copy[key] = type(value) == "table" and deepCopy(value) or value
301304
end
305+
306+
-- Return the finalized copy of the deep cloned table
302307
return copy
303308
end
304309
```

content/en-us/reference/engine/classes/Tool.yaml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,10 @@ properties:
9494
summary: |
9595
Stores the tool's "grip" properties as one `Datatype.CFrame`.
9696
description: |
97-
The Grip property stores the tool's "grip" properties as a single
97+
The `Grip` property stores the tool's "grip" properties as a single
9898
`Datatype.CFrame`. These properties position how the player holds the tool
99-
and include `GripUp`, `GripRight`, `GripForward`, and `GripPos`.
100-
101-
Unlike the grip properties that it stores, this consolidated property
102-
doesn't appear in the [Properties](../../../studio/properties.md) window
103-
in Studio. Regardless, you can set and get it from a `Class.Script` or
104-
`Class.LocalScript`.
99+
and include `Class.Tool.GripUp|GripUp`, `Class.Tool.GripRight|GripRight`,
100+
`Class.Tool.GripForward|GripForward`, and `Class.Tool.GripPos|GripPos`.
105101
code_samples:
106102
- grip-stick
107103
type: CFrame

0 commit comments

Comments
 (0)