 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
cd& Newbie cheater
Reputation: 0
Joined: 08 Apr 2023 Posts: 20
|
Posted: Fri Jul 19, 2024 2:00 am Post subject: why readBytes(address,2,false) == readBytes(address,1,false) |
|
|
I want bytes form addresses.
so, I write readBytes(address,16) .
but code returns not multiple bytes but single number.
celua.txt says :readByte() returns the bytes at the given address. If ReturnAsTable is true it will return a table instead of multiple bytes
Reads the bytes at the given address and returns a table containing the read out bytes
I don't understand it. Is it bug?
example:
address 12569ec0 12569ec1 .........
value 6c fd .........
readBytes(12569ec0,2,true) ={20,22}
and it shuld be readBytes(12569ec0,1,false) =20,readBYtes(12569ec0,2,false) =2220
but readBytes(12569ec0,1,false)=readBytes(12569ec0,2,false) =20 |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 468
Joined: 09 May 2003 Posts: 25711 Location: The netherlands
|
Posted: Fri Jul 19, 2024 2:43 am Post subject: |
|
|
readBytes without table format just returns multiple bytes without being inside a lua table
e.g:
Code: |
b1,b2,b3,b4=readBytes(0x00400500,4)
|
will put the byte of 00400500 at b1, 00400501 at b2, 00400502 at b3 and 00400503 at b4
as for why == returns true no idea, but using == on something that returns multiple results is ambiguous at best _________________
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 |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017 Posts: 1485
|
Posted: Fri Jul 19, 2024 3:10 am Post subject: |
|
|
Code: | function readHex(address, byte)
local bytestring1={}
local str=''
bytestring1=readBytes(address, tonumber(byte), true)
for i,k in pairs(bytestring1) do
str=str..string.format('%02x ',bytestring1[i])
end
return str:upper()
end
addr = "12569ec0"
print(readHex(addr,1))
print(readHex(addr,2))
print(readHex(addr,3))
print(readHex(addr,20)) |
_________________
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 150
Joined: 06 Jul 2014 Posts: 4657
|
Posted: Fri Jul 19, 2024 10:01 am Post subject: |
|
|
Not a bug. That's just how multiple values in Lua work. See section 3.4 of the Lua 5.3 reference manual:
https://www.lua.org/manual/5.3/manual.html#3.4
Code: | function f1()
return 1,2
end
function f2()
return 1,3
end
assert(f1() == f2()) | In the assert, the expressions `f1()` and `f2()` are adjusted to a single return value. The first value returned is kept and used for the comparison. All others (i.e. 2 and 3 respectively) are discarded. Thus, the comparison becomes `1 == 1` which is true. _________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
cd& Newbie cheater
Reputation: 0
Joined: 08 Apr 2023 Posts: 20
|
Posted: Sat Jul 20, 2024 1:26 am Post subject: |
|
|
oh, I understand how it works.
Thank you very much |
|
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
|
|