ertlflorian1 Posted June 10, 2013 Share Posted June 10, 2013 Why it everytime outputs for a and e 1? addCommandHandler ("mi", function (player, cmd, wert) zahl = tostring (wert) outputChatBox (zahl) a , e = string.find (zahl, ".") outputChatBox ("a:"..a.." e:"..e) end) Example: Ingame /mi 41.1 then a: 2 e: 3 Link to comment
DiSaMe Posted June 10, 2013 Share Posted June 10, 2013 Unless specified otherwise, string.find uses patterns rather than plain strings. Dot is one of the special characters and it means any character. You either have to disable the pattern matching a , e = string.find (zahl, ".", 1, true) Or escape the magic character a , e = string.find (zahl, "%.") 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