Jump to content
  • 0

Edit only one final value


Khi

Question

Hello everyone, I hope I can find some help.

gg.setRanges(32)

gg.searchNumber("10000",4)

R=gg.getResults(gg.getResultsCount())

...

I get about a hundred results. However, I only want to edit one value in the last position and one value in the seven position.

Hope everyone can write for me.

 

 

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

25 minutes ago, MonkeySAN said:

try this..?

local t = gg.getResults(100)

gg.setValues({
    {address = t[7].address, flags = 4, value = your value},
    {address = t[100].address, flags = 4, value = your value}
    })

gg.clearResults()
end

 

Thank you very much. However, that is not my intention.

Every time I search, I get a different total of results (Example: first time: 132 results, second time: 165 results...). The total number of results is different, so I can't set the value as you instructed .I just want to edit the value in the last position.

Ex:

gg.searchNumber("10000",4)

+First time: 132. I just want to edit the value 10000 at the last position 132.

However, the results next time will be different. I don't know how to edit!

 

 

Link to comment
Share on other sites

You can use second parameter of "getResults" function to get (only) the last result: 

local count = gg.getResultsCount()
local result = gg.getResults(1, count - 1)
result[1].value = 123
gg.setValues(result)
Link to comment
Share on other sites

1 minute ago, CmP said:

You can use second parameter of "getResults" function to get (only) the last result: 

local count = gg.getResultsCount()
local result = gg.getResults(1, count - 1)
result[1].value = 123
gg.setValues(result)

Thank you very much. Everything is perfect!

Link to comment
Share on other sites

11 hours ago, MonkeySAN said:

next time be TOTAL clear and details with your intentions.

otherwise my solution would had been as close as Cmp if not the same.

I prefer to write it this way, I think it looks cleaner:

gg.getResults(gg.getResultsCount() - 1)

gg.editAll(";I'msocool",gg.TYPE_WORD) -- Ignore this xD

Link to comment
Share on other sites

local R = gg.getResults(gg.getResultsCount())

local edits = {R[7], R[#R]}
edits[1].value = 50
edits[2].flags = 16 --if you want to change value type or something.
edits[2].value = 100 --# mean total member of variable. So if result is 169, R[#R] is R[169]. last member.
gg.setValues(edits)

--or below is more cleaner code. for me at least.
local edits = {
  {address=R[7].address, flags=4, value=50},
  {address=R[#R].address, flags=16, value=100}
}
gg.setValues(edits)

I know there is already answer. I just want to share easier codes to understand.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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