'LinKin Posted June 21, 2014 Share Posted June 21, 2014 Hello, How can I iter character by character of a string? Like: "This_String_For_Example" I want to check one by one each character. Thanks. Link to comment
xXMADEXx Posted June 21, 2014 Share Posted June 21, 2014 You can use something like this: function runaString ( str ) local len = str:len ( ) for i=0, len-1 do local c = str:sub ( i, i ) -- c = the char end end Link to comment
ixjf Posted June 21, 2014 Share Posted June 21, 2014 Alternatively, you can use string.gmatch: local str = "Hello, world" for c in str:gmatch ( "." ) do outputChatBox ( c ) end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now