'LinKin Posted June 21, 2014 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. Need a clanwar script? Click here! Do you want some free scripts for your DD server? Visit my website.
xXMADEXx Posted June 21, 2014 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 The Ultimate Lua Tutorial! | MTA PHP SDK
ixjf Posted June 21, 2014 Posted June 21, 2014 Alternatively, you can use string.gmatch: local str = "Hello, world" for c in str:gmatch ( "." ) do outputChatBox ( c ) end I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
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