tommymaster Posted January 15, 2018 Posted January 15, 2018 Hi! After a few minutes of research i finall found a way to take out letters from a string. This is an example: local text = "test3" print (text:gsub('test', '')) It outputs " "3" 1" but i only need number 3 after the word. How may i take out the number 1 after 3 and convert "3" to number?
Tails Posted January 15, 2018 Posted January 15, 2018 it does return just 3, print just outputs both arguments it returns. local text = "test3test3" local num, count = text:gsub('test', '') print(num) --> 33 print(count) --> 2 1
tommymaster Posted January 18, 2018 Author Posted January 18, 2018 (edited) and if for example if i have a string as variable like this: "1x5" how can i take out the "1x", and the opposite, how could i take out "x5"? Edited January 18, 2018 by tommymaster
URBAN Posted January 18, 2018 Posted January 18, 2018 7 hours ago, tommymaster said: and if for example if i have a string as variable like this: "1x5" how can i take out the "1x", and the opposite, how could i take out "x5"? https://wiki.multitheftauto.com/wiki/Split split(string,"1x") 1
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