Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is the difference between deprecated and non-deprecated functions?

Asked by 4 years ago

When I use this: :connect() or :disconnect() or :wait() , it says to use :Connect() or :Disconnect() or :Wait()

6
Deprecation, defined as the discouragement of use of some terminology, feature, design, or practice, typically because it has been superseded or is no longer considered efficient or safe, without completely removing it or prohibiting its use, is just that, discouragement theking48989987 2147 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

This answer is an extension to @theking48989987's comment. It will also tell you why the functions are deprecated.

Deprecation is a term used to refer to something that is not recommended or is disapproved of. When a function is deprecated, it can still be used; however, it isn't recommended to use that function. But why are they deprecated?

The simple answer is a change in the programming case that Roblox Lua uses. As of 2019, Roblox Lua uses PascalCase, which is a case in which every word in a variable or function name is capitalized (for example, MyVariable). Functions such as FindFirstChild() and IsA() use PascalCase.

Before Roblox shifted to PascalCase, function names used camelCase, which is a case where the first word isn't capitalized but every word after it is capitalized. Variable names that use camelCase are very popular among Roblox scripters because they "look better". (To you, does myVariable look better than MyVariable? Think about it.) Before every word in FindFirstChild() was capitalized, it was findFirstChild(). The same goes for IsA(), which used to be isA().

Because the current standard of function naming is PascalCase in Roblox, any time you type a camelCase function (one that is part of an already existing API, not an API that you have created), you will be asked to change it to its PascalCase variant. Functions that are part of the Roblox API no longer use camelCase yet their camelCase variants can still be used. That is why the functions are deprecated: Roblox doesn't want you to use camelCase, they want you to use PascalCase to keep up with their standard.

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

If a function is deprecated, it means that it is no longer encouraged as a neat and efficient way of writing the function. Most people used to use :connect() instead of :Connect() because it took out the holding of shift when you press the 'C'. However, this is no longer recommended and is now looked down upon because it is deprecated.

Answer this question