Is it possible to find out a certain character that’s in a string? Like by doing "Character[1] of “how” to get “h”? If so, how?
yep, google “lua string.sub”
Thanks
function setup()
str="abcedfghijklmnopqrstuvwxyz"
print(string.sub(str,5,5)) -- single character
print(string.sub(str,7,15)) -- range of characters
end
One thing to watch is that string.sub
works on bytes not characters. This is fine if you are using ascii characters (and maybe latin, I don’t remember off the top of my head) but will get you in to trouble with proper unicode.
(Fortunately, I have a library for handling unicode strings if you need it.)