Is there a way you can get the first letter in a string or the second or whatever number. Through how stuff normally is on roblox studio I originally though it would be like this:
Str = "Stri"
print(Str[3])
but instead it prints nil.
Is there a way you can get the first letter in a string or the second or whatever number. Through how stuff normally is on roblox studio I originally though it would be like this:
Str = "Stri"
print(Str[3])
but instead it prints nil.
Strings have something called substring, wich is accesed by doing string:sub(StringValue,start,end)
if we do
string.sub("Hello, world!",1,1) we would get H as return.
if we do
string.sub("Hello, world!",2,4) we would get ell as return.
you can also do
("Hello"):sub(start,end) or MyStringValue:sub(start,end)
If you have any questions, feel free to post a comment.
Suggest also reading this short wiki article
thanks you are a legend
same
super helpful
i dont understand how to make it detect like all leters and put it in a value
Str = "Stri"
print(string.sub(Str, 1))
Post explaination. just posting code doesnt help people learn what it does.
this site is toxic as hell im done with it
You couldn't honestly believe this was a valid answer is any way shape or form.
what the, why did this get 3 downvotes, its literally the same thing as above
This does not deserve to get downvoted. Upvote it back!
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
We are not in python xDDDDD