Skip to content

Commit b9a8255

Browse files
authored
Remove extra whitespace and remove reference to being able to assign Enum properties to an EnumItem's value
1 parent 0f1cd61 commit b9a8255

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

content/en-us/luau/enums.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,13 @@ print(Enum.PartType.Cylinder.Value) --> 2
4545
print(Enum.PartType.Cylinder.EnumType) --> PartType
4646
```
4747

48-
To assign an `Datatype.EnumItem` as the value of a property, use the full `Datatype.Enum` declaration. You can also use its `Value` or `EnumType`.
49-
50-
<Alert severity="warning">
51-
Assigning `Datatype.EnumItem` properties like `Class.Part.Shape|Shape` to the `DataType.EnumItem.Value|Value` property is bad practice, as the `DataType.EnumItem.Value|Value` property can be moved around if a new `Datatype.EnumItem` is added to the `Enum.PartType` enum.
52-
Meaning your code may break if you rely on assigning `Datatype.EnumItem` via their `DataType.EnumItem.Value|Value`.
53-
</Alert>
48+
To assign an `Datatype.EnumItem` as the value of a property, use the full `Datatype.Enum` declaration. You can also use its `Datatype.EnumItem.Name|Name`.
5449

5550
```lua
5651
local Workspace = game:GetService("Workspace")
5752

58-
local part = Instance.new("Part") -- Create a new part
53+
local part = Instance.new("Part") -- Create a new part
5954
part.Shape = Enum.PartType.Cylinder -- By EnumItem (best practice)
60-
part.Shape = Enum.PartType.Cylinder.Value -- By EnumItem Value
61-
part.Shape = 2 -- By EnumItem Value
6255
part.Shape = Enum.PartType.Cylinder.Name -- By EnumItem Name
6356
part.Shape = "Cylinder" -- By EnumItem Name
6457
part.Parent = Workspace

0 commit comments

Comments
 (0)