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

What does :lower() mean?

Asked by
Teeter11 281 Moderation Voter
10 years ago

What does it mean? And how do i use it?

2 answers

Log in to vote
2
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

The lower method is used to basically make ROBLOX understand something's name as all lowercase letters.

Ex:

while true do
if game.Players.LocalPlayer.Name:lower() == "bob" then
game.Players.LocalPlayer:Kick()
end
end

Btw, I've actually met someone named Bob on ROBLOX.

-Thank me by accepting this answer/bumping up my reputation!

0
There's no wait() :( BestCreativeBoy 1395 — 3y
Ad
Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago

lower is a method of the string class that changes all uppercase characters to lowercase.

("CAPS"):lower() is accessing the string table by the string object that gets created, so all of the member functions included in string are methods of each string object where the object itself is the first argument. ex:

print(string.lower("CAPS"))

is the same as

print(("CAPS"):lower())

and

print(("1waffle1").lower("CAPS"))

(if you can come up with a practical application for this one, tell me)

It all revolves around how literals are transformed into classes and how : is the same as indexing a function and calling it with its first argument being the object you're indexing it from.

Answer this question