Jump to content

[HELP] Reading numbers before text


Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...