 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Sanglante Cheater
Reputation: 0
Joined: 27 Sep 2018 Posts: 43
|
Posted: Sun Oct 25, 2020 3:37 am Post subject: Pass Table as function argument. |
|
|
Hi.
I'm trying to save my original aobscan in a var as a Table
Why my table isn't feeding ?
| Code: | function DoScanReportResults(Name, ByteArray, Save, Lenght, SaveTable)
local res = AOBScan(ByteArray)
if res ~= nil then
for i=0, res.Count-1, 1 do
registerSymbol(Name, res[i])
if Save == 1 then
SaveTable = ReadBytes(Name,Lenght,true)
end
res.destroy()
end
end
Scan1Save = {}
Scan2Save = {}
Scan3Save = {}
Scan1Array = "my long array stuff"
Scan2Array = "my long array stuff"
Scan3Array = "my long array stuff"
DoScanReportResults("Scan1Orig", Scan1Array, 1, 9, Scan1Save)
DoScanReportResults("Scan2Orig", Scan2Array, 1, 9, Scan2Save)
DoScanReportResults("Scan3Orig", Scan3Array, 1, 9, Scan3Save) |
Thx for any help !
Last edited by Sanglante on Sun Oct 25, 2020 3:45 am; edited 1 time in total |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Sun Oct 25, 2020 3:45 am Post subject: |
|
|
you are replacing the table with a new table instead of entering the data in the old table
this might work better
| Code: |
function DoScanReportResults(Name, ByteArray, Save, Lenght, SaveTable)
local res = AOBScan(ByteArray)
if res ~= nil then
for i=0, res.Count-1, 1 do
registerSymbol(Name, res[i])
if Save == 1 then
local result=ReadBytes(Name,Lenght,true)
local j
for j=1,#result do
SaveTable[j]=result[j]
end
SaveTable[#result+1]=nil
end
res.destroy()
end
end
Scan1Save = {}
Scan2Save = {}
Scan3Save = {}
DoScanReportResults("Scan1Orig", NoCurlOrigArray, 1, 9, Scan1Save)
DoScanReportResults("Scan2Orig", LongLine1OrigArray, 1, 9, Scan2Save)
DoScanReportResults("Scan3Orig", LongLine2OrigArray, 1, 9, Scan3Save)
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Sanglante Cheater
Reputation: 0
Joined: 27 Sep 2018 Posts: 43
|
Posted: Sun Oct 25, 2020 3:50 am Post subject: |
|
|
so i have to create a new table and copy this one in my argument Table ?
can't directly feed my argument Table ?
and may you explain #result ? the # mean ? it's like a count ?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25833 Location: The netherlands
|
Posted: Sun Oct 25, 2020 4:15 am Post subject: |
|
|
Yes, readBytes returns a new table
see a table like a pointer
x={}
x.a=123
x.b=456
x is just a pointer to a structure holding 'a' and 'b'
if you do x.a=123 then you follow the pointer of x to the memoryblock where a is and then write to a
if you do x={} then you replace the pointer of x with a pointer to a new memoryblock losing the way to access x.a and x.b
and yes, # is the number of entries until the first nil entry (which is why I make the last one nil in case you provide it with a table that already had data)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| 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
|
|