Jump to content
  • 0

How to load result from table?


Ardit19
 Share

Question

gg.searchNumber("h 10 00 90 E5 1E FF 2F E1 1C 30 9F E5", gg.TYPE_BYTE, false, gg.SIGN_EQUAL, 0, -1)
gg.refineNumber("16", gg.TYPE_BYTE)
gg.searchPointer(0)
results = gg.getResults(15)
gg.addListItems(results)
test = gg.getListItems()
gg.clearResults()
gg.clearList()

 

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 1
19 minutes ago, MC874 said:

Hi @Ardit19, to load the 3rd results, you can just do this:

results = gg.getResults( gg.getResultsCount() )
gg.loadResults({results[2]})

Do note that LUA tables behave like an Array, it starts from 0. So 3rd results will be 2 (Location - 1).

It start from 1 you mean ?

Link to comment
Share on other sites

  • 1
On 11/21/2023 at 2:43 PM, Ardit19 said:

I found a way to do it from first value to go to 3rd without needing to save all results. You say that the code you attached will load first three results but I want to load only the third for example. If there is a way if not I will stick to the solution I found.

The code @MC874 provided actually do what you described except that index is 3 since lua table index start at 1 instead of 0

Edited by MAARS
Link to comment
Share on other sites

  • 0

Hi @Ardit19, to load the 3rd results, you can just do this:

results = gg.getResults( gg.getResultsCount() )
gg.loadResults({results[2]})

Do note that LUA tables behave like an Array, it starts from 0. So 3rd results will be 2 (Location - 1).

Link to comment
Share on other sites

  • 0
4 hours ago, MAARS said:

It start from 1 you mean ?

I found a way to do it from first value to go to 3rd without needing to save all results. You say that the code you attached will load first three results but I want to load only the third for example. If there is a way if not I will stick to the solution I found.

Edited by Ardit19
Link to comment
Share on other sites

  • 0
1 hour ago, MAARS said:

The code @MC874 provided actually do what you described but only that the index is 3 since lua table index start at 1 instead of 0

Noted!

6 hours ago, MC874 said:

Hi @Ardit19, to load the 3rd results, you can just do this:

results = gg.getResults( gg.getResultsCount() )
gg.loadResults({results[2]})

Do note that LUA tables behave like an Array, it starts from 0. So 3rd results will be 2 (Location - 1).

Thanks mate!

Link to comment
Share on other sites

  • 0
Quote

It start from 1 you mean ?

Yeah, thank you for the correction. At first, I thought it's start from 0 like most language.

Quote

You say that the code you attached will load first three results but I want to load only the third for example

No, it's only load the third result, not first three (1-3) results.

Quote

then pointer search it again

Forgot to mention, you can also do pointer search for only the third result like this:

--Save results to variable "results"
results = gg.getResults( gg.getResultsCount() )
--Specifying number of pointers to find
MAX_VALUE = 512
--Load specific (3rd) result
gg.loadResults( { results[3] } )
--Search for a pointer with specified "MAX_VALUE"
gg.searchPointer( MAX_VALUE )

Read the documentation here: gg.searchPointer() & gg.loadResults()

Quote

Thanks mate!

Your welcome 🙂

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.