  | 
				
				Cheat Engine The Official Site of Cheat Engine   
				
 
				 | 
			 
		 
		 
	
		| View previous topic :: View next topic   | 
	 
	
	
		| Author | 
		Message | 
	 
	
		Twistedfate Expert Cheater
  Reputation: 1
  Joined: 11 Mar 2016 Posts: 231
 
  | 
		
			
				 Posted: Thu Jun 25, 2020 4:12 am    Post subject: How to read array of bytes with LUA | 
				       | 
			 
			
				
  | 
			 
			
				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 .
	
  
	 
	
	
		
	 
	
		|  Description: | 
		
			
		 | 
	 
	
		|  Filesize: | 
		 57.67 KB | 
	 
	
		|  Viewed: | 
		 4222 Time(s) | 
	 
	
		
  
 
  | 
	 
	 
	 
 | 
			 
		  | 
	 
	
		| Back to top | 
		 | 
	 
	
		  | 
	 
	
		mgr.inz.Player I post too much
  Reputation: 222
  Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
  | 
		
			
				 Posted: Thu Jun 25, 2020 5:47 am    Post subject:  | 
				        | 
			 
			
				
  | 
			 
			
				 	  | 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 | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
	 
	    
	   | 
	
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
  | 
   
 
		 |