|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
alanze Advanced Cheater Reputation: 3
Joined: 03 Oct 2012 Posts: 50
|
Posted: Sat Jun 21, 2014 2:05 pm Post subject: Get the length of AOBScan array |
|
|
How can I get the length of AOBScan array?
I tried this methods but they doesn't work for me:
Code: |
AoB=AOBScan("CC CC CC CC", "+W-X-C")
if (AoB~=nil) then
theLength=AoB.Count --this returns nothing (nil?)
if (AoB.Count < 9) then print("less") end --Error: attempt to compare nil with number
theLength=#AoB --Error: attempt to get length of global 'AoB' (a userdata value)
theLength=table.maxn(AoB) --Error: bad argument #1 to 'maxn' (table expected, got userdata)
theLength=table.getn(AoB) --Error: bad argument #1 to 'getn' (table expected, got userdata)
for key,value in pairs(AoB) do print(key,value) end --Error: bad argument #1 to 'pairs' (table expected, got userdata)
end
|
The error message tells me that AoB is not an array or table, it's a userdata.
However i can use it as an array, like:
address2=AoB[1] --and so on..
I also tried replacing "AoB.Count" with "AoB.Length", same errors occurred.
So, how to determine its length?
I use CE 6.3.
|
|
Back to top |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Sat Jun 21, 2014 2:50 pm Post subject: |
|
|
Try use this.
Code: | AoB=AOBScan("CC CC CC CC ?? ?? ?? ??", "+W-X-C");
if (AoB) then -- If AoB contains any value that is not false or nil...
local count = stringlist_getCount(AoB); -- String object..
if (count < 9) then -- You shouldn't do AoB.Count, as you got the count above defined already...
print("less");
end
for i=0, count-1 do
local address = stringlist_getString(AoB, i);
local value = readBytes(address, 8, true); -- Returns read bytes as table...
local _value; -- Pre defining ..
for k,v in pairs (value) do
_value = (_value or '') .. (#string.format('%x', v) < 2 and '0' .. string.format('%x', v) or string.format('%x', v)); -- Checks if _value is defined and checks length of byte is less than 0, adds 0 before if true.
end
print('Address = 0x' .. address .. '; Value = ' .. _value .. ';'); -- output address in hex format, 8byte value.
end
end |
Also I checked the AoB.Count, seems to works fine? try getting latest C.E (recommended as new version is out).
_________________
|
|
Back to top |
|
|
alanze Advanced Cheater Reputation: 3
Joined: 03 Oct 2012 Posts: 50
|
Posted: Sat Jun 21, 2014 6:13 pm Post subject: |
|
|
Yes, you're right, "stringlist_getCount(AoB)" got the lenght.
Also I discovered another method: "AoB.getCount()"
I updated from CE6.3 to CE6.4 and now "AoB.Count" is also working.
Thanks for the help and guidance.
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|