Jump to content

[HELP] Reading numbers before text


..:D&G:..

Recommended Posts

Posted

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.

76561198066470453.png

SP37Ecj.jpg?2MTA:Rust Pre-Alpha Build v.0.3:SP37Ecj.jpg?2

https://forum.mtasa.com/viewtopic.php?f=114&t=97848

2Pac: ''Only God can judge me!''

Posted

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.

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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...