I want to get just he first character in a string
string = "Hello"
print(string[1])
print(string:sub(1))
print(string.sub(1))
None of these worked.
I want to get just he first character in a string
string = "Hello"
print(string[1])
print(string:sub(1))
print(string.sub(1))
None of these worked.
Well "string" is a keyword used by lua i recommend not making a variable called that try something like str?
print(string.sub(str, 1,1))
Good answer, but next time try to put your code in a code block. :)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
DevArk is correct but a quicker way to call it is: print(string:sub(1,1))