Piorun Posted June 18, 2011 Share Posted June 18, 2011 Hi I want today to get a number of letters in word. For ex. I've got word "gta", and i want to create a function which i can output into chat box the number of letters in this word - 3. How to do it? Link to comment
gokalpfirat Posted June 18, 2011 Share Posted June 18, 2011 gta = "gta" outputChatBox ( #gta, getRootElement(), 0, 255, 0, true ) I dont test it but it can work. Link to comment
JR10 Posted June 18, 2011 Share Posted June 18, 2011 gta = "gta" outputChatBox ( #gta, getRootElement(), 0, 255, 0, true ) I dont test it but it can work. Hmm, i am not sure but i think that won't work here: string.len('gta') Link to comment
gokalpfirat Posted June 18, 2011 Share Posted June 18, 2011 text = "gta" outputChatBox ( #text, getRootElement(), 0, 255, 0 ) I test it and works:) Link to comment
Aibo Posted June 18, 2011 Share Posted June 18, 2011 gta = "gta" outputChatBox ( #gta, getRootElement(), 0, 255, 0, true ) I dont test it but it can work. Hmm, i am not sure but i think that won't work # returns table length if used with a table (numeric indexed) and string length if used with a string Link to comment
JR10 Posted June 18, 2011 Share Posted June 18, 2011 He said it works i thought it won't because it's for tables so anyway it should be string.len. Link to comment
Antibird Posted June 19, 2011 Share Posted June 19, 2011 because it's for tables Both strings and tables lua.org Link to comment
Piorun Posted June 19, 2011 Author Share Posted June 19, 2011 string.len() - it's working. Thanks. 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