Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to read array of bytes with LUA

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
Twistedfate
Expert Cheater
Reputation: 1

Joined: 11 Mar 2016
Posts: 231

PostPosted: Thu Jun 25, 2020 4:12 am    Post subject: How to read array of bytes with LUA Reply with quote

I'm trying to use
readBytes(address,bytecount, ReturnAsTable )

but IDK what does ReturnAsTable means
Quote:
it will return a table instead of multiple bytes


another thing
Code:
print(readBytes('0018F6AC',80));


this code give me Script Error:not enough memory
while I want to read all bytes like ce do in the address list
and the output in hex .

and if you got time build loop that read this address every 1 sec because I still bad in lua .



aob.JPG
 Description:
 Filesize:  57.67 KB
 Viewed:  4122 Time(s)

aob.JPG


Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jun 25, 2020 5:47 am    Post subject: This post has 1 review(s) Reply with quote

Quote:
Code:
print(readBytes('0018F6AC',80))



readBytes('0018F6AC',80) will pass 80 arguments to the print function. This is why you get "not enough memory".


This should work:
Code:
print(  table.concat(readBytes('0018F6AC', 80, true), ' ')  )





For hexadecimal:
Code:
decByteString = table.concat(readBytes('0018F6AC', 80, true), ' ')
hexByteString = decByteString:gsub('%S+',function (c) return string.format('%02X',c) end)

print( hexByteString )

_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites