local str = "Hello"
print(string.find(str,"Hello"))
I was just doing test with string.find and when i ran it, it printed 1,5, can someone explain much better what 1 5 means and what does it have to do with Hello?
local str = "Hello"
print(string.find(str,"Hello"))
I was just doing test with string.find and when i ran it, it printed 1,5, can someone explain much better what 1 5 means and what does it have to do with Hello?
It is printing the subbed value of the string. 1 is the amount of characters being divided into strings and 5 is the number of characters being returned. Because "Hello" has 5 characters, that is what the second parameter will print.
Eg a script that is written
local str = "Hello World!"
print(string.find(str,"Hello World!"))
will return a value of 1,12 because there are 12 characters total
This discussion is preserved as it was. New answers, comments, and votes are closed.