Skip to content

Commit 57ba199

Browse files
committed
Inital commit
1 parent 8925bf4 commit 57ba199

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

content/en-us/luau/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Luau includes the following data types:
2222
- [Numbers](numbers.md), or `double`, represent double-precision (64-bit) floating-point numbers.
2323
- [Strings](strings.md) are sequences of characters, such as letters, numbers, and symbols.
2424
- [Tables](tables.md) are [arrays](tables.md#arrays) or [dictionaries](tables.md#dictionaries) of any value except `nil`.
25-
- [Enums](enums.md) are fixed lists of items.
2625

2726
Luau is dynamically typed by default. Variables, function parameters, and return values can be any data type. This helps you write code faster because you don't need to provide types for each piece of data. You can still declare explicit types for variables in Luau and enable [strict type checking](type-checking.md) to make type issues obvious and easy to locate.
2827

content/en-us/luau/enums.md renamed to content/en-us/scripting/enums.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ To get all items of an Enum, call the `GetEnumItems()` method on the enum. The f
1111

1212
```lua
1313
local partTypes = Enum.PartType:GetEnumItems()
14+
1415
for index, enumItem in partTypes do
1516
print(enumItem)
1617
end
@@ -34,15 +35,20 @@ Some properties of objects can only be items of certain enums. For example, the
3435

3536
```lua
3637
-- Properties of the EnumItem called Enum.PartType.Cylinder
37-
print(Enum.PartType.Cylinder.Name) -- Cylinder
38-
print(Enum.PartType.Cylinder.Value) -- 2
39-
print(Enum.PartType.Cylinder.EnumType) -- PartType
38+
print(Enum.PartType.Cylinder.Name) --> "Cylinder"
39+
print(Enum.PartType.Cylinder.Value) --> 2
40+
print(Enum.PartType.Cylinder.EnumType) --> PartType
4041
```
4142

4243
## Assign enum items
4344

4445
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`.
4546

47+
<Alert severity="warning">
48+
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.
49+
Meaning your code may break if you rely on assigning `Datatype.EnumItem` via their `DataType.EnumItem.Value|Value`.
50+
</Alert>
51+
4652
```lua
4753
local Workspace = game:GetService("Workspace")
4854

@@ -52,6 +58,5 @@ part.Shape = Enum.PartType.Cylinder.Value -- By EnumItem Value
5258
part.Shape = 2 -- By EnumItem Value
5359
part.Shape = Enum.PartType.Cylinder.Name -- By EnumItem Name
5460
part.Shape = "Cylinder" -- By EnumItem Name
55-
5661
part.Parent = Workspace
5762
```

content/en-us/scripting/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If you've never written code before and want an introduction to programming, see
1313

1414
## Luau
1515

16-
Roblox scripts use the [Luau](https://luau-lang.org) programming language, which is derived from [Lua 5.1](https://www.lua.org/manual/5.1/).
16+
Roblox scripts use the [Luau](https://luau.org) programming language, which is derived from [Lua 5.1](https://www.lua.org/manual/5.1/).
1717

1818
- Compared to Lua 5.1, Luau adds performance enhancements and many useful features, including an optional typing system, string interpolation, and generalized iteration for tables.
1919
- All valid Lua 5.1 code is valid Luau code, but the opposite is not true.

0 commit comments

Comments
 (0)