..:D&G:.. Posted February 15, 2015 Share Posted February 15, 2015 Hello guys, I need a bit of help with reading a number (0.00) before a text (0.00 Text) At the moment my script reads the numbers after a text, like this: (text 0.00) using this code: guiGridListGetItemText(shopItemsList, row, 2):sub(6) Is there a :sub kinda things that does the revers? To read the numbers from right to left? Thank you. Link to comment
JR10 Posted February 15, 2015 Share Posted February 15, 2015 If the text is always gonna be in that format (0.00 Text) then it's easy using sub: guiGridListGetItemText(shopItemsList, row, 2):sub(1, 4) Link to comment
..:D&G:.. Posted February 15, 2015 Author Share Posted February 15, 2015 And what if sometimes it is in the format (00.00 Text)? Link to comment
JR10 Posted February 15, 2015 Share Posted February 15, 2015 Then you need a pattern to do the work for you, a simple one like this might do: guiGridListGetItemText(shopItemsList, row, 2):match("%d+.%d+") It will extract the number whether it's "Text 00.00", "00.00 Text". Also the amount of digits won't matter. Link to comment
..:D&G:.. Posted February 15, 2015 Author Share Posted February 15, 2015 It worked, thanks a lot 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