Jump to content
  • 0

How to get all values whose address are in a specific distance in script?


Bennywang

Question

Posted

As the title, I'd like to get all the values that their addresses are in a specific distance in script.

For instance, after searching, I get several results. Their addresses are (0x000000)0014, 0018, 001C, 0020, 0028, 002C, 0060, 006C, 0078. And I want to delete all the data with which no any other data has a distance of 000c.

(0014, 0020), (001C, 0028), (0020, 002C), (0060, 006C), (006C, 0078) are pairs whose elements are in distance of c, and these data are what I want to keep.

The only way I come up with is:

u = gg.getResultsCount()
t = gg.getResults(u)
b = {}
for i = 1, u do
    b[i] = false
end
for i = 1, u-1 do
    for j = i+1, u do
        if ( t[j].address - t[i].address) == 0x000000000c then
            b[i] = true
            b[j] = true
        end
    end
end
t2 = {}
j = 1
for i = 1, u do
    if b[i] then
        t2[j] = t[i]
        j = j + 1
    end
end

But it seems to be too complex. I hope there are some easier ways to do this.

Thanks. 

 

 

 

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.