This tutorial is based on the string functions and will require some basic scripting knowledge.
string.match is a function to detect patterns in strings. For instance, let's say I have 2 variables that represent strings.
local StringToDetect = "Hello, world!" local WhatToDetect = "ello, wo"
Now, let's say I wanted to print the matching patterns in our Strings, that's where string.match() comes in:
Now, the reason it does this is because some of the letters in our variable "StringToDetect" matches some of the characters in the variable "WhatToDetect". I'm pretty sure you will be able to get the hang of it.
string.rep() is a function for repetition. If I wanted to print out "DEVLOgiC_1 IS THE BEST ROBLOXIAN" 5 times, which I'm sure you do too, most of you would write it like this:
print("DEVLOgiC_1 IS THE BEST ROBLOXIAN") print("DEVLOgiC_1 IS THE BEST ROBLOXIAN") print("DEVLOgiC_1 IS THE BEST ROBLOXIAN") print("DEVLOgiC_1 IS THE BEST ROBLOXIAN") print("DEVLOgiC_1 IS THE BEST ROBLOXIAN")
for i = 1,5 do print("DEVLOgiC_1 IS THE BEST ROBLOXIAN") end
But, what If I told you there was a simpler way to do this?! This is where string.rep() comes in.
print(string.rep("DEVLOgiC_1 IS THE BEST ROBLOXIAN",5))
string.rep() prints the first argument as much as the second argument.
string.reverse() is a function to reverse a string you put in:
so, let's say I had a variable called "Example"
local Example = "DEVLOgiC_1 IS THE BEST ROBLOXIAN"
Now, I can reverse the string using: string.reverse()
NAIXOLBOR TSEB EHT SI 1_CigOLVED
string.upper() is a function to capatalize every single letter of your string. Pretty simple.
I want to make a variable called "IAMCOOL"
local IAMCOOL = "i am cool"
Now, I want to make this variable all capitalized, I would use string.upper()
I AM COOL
OMG it's telling the truth for once O: ^
string.lower() is like string.upper() except it makes the string all lower case.
print(string.lower(" I LIKE CHOCOLATE, DO YOU?? "))
i like chocolate, do you??
I don't really think I need to explain this function anymore.
string.len() is a function to recieve the amount of characters that are in the string. (spaces are included)
print(string.len("DEVLOgiC_1 IS COOL"))
Think of string.format() as a way to edit strings on the go. To me, it's kind of confusing. I will try to explain it. I think of it as a way to leave blanks in the string and then edit them later. You can leave blanks by using "%q", but there are many ways to leave blanks. Here is an example:
print(string.format("I like to eat %q.", "Pizza"))
I like to eat "Pizza".
I hope you enjoyed my first tutorial, please thumbs up and give me your feedback on how to make this tutorial better. Thank you so much! I will be updating this tutorial more soon.