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 


Cheat Engine Forum Index
PostGo back to topic
FreeER
Grandmaster Cheater Supreme
Reputation: 42
Joined: 09 Aug 2013
Posts: 1089

PostPosted: Mon Jun 26, 2017 5:23 pm    Post subject:

yeah, it should be 168 Smile

Code:
attempt to perform arithmetic on a nil value (local 'addr')
means that addr had the value nil (basically undefined or not set) but was used in some kind of math (in this case addition). Since the code tries to set it to tonumber(f.Address[i]) that means that tonumber returned nil instead of a valid number, which means that what it got wasn't a valid number.... ah, I forgot that the string is going to be in hex like "4003BC" and that tonumber assumes it'll be base 10 by default where a letter would mean it's not a valid number.

simple example code
Code:
print(tonumber("A")) -- nil (not a base 10 number)
print(tonumber("A",16)) -- 10, 9+1 in base 16 is 0xA, decimal 10
print(tonumber("G",16)) -- nil, not a valid digit in hex, only 0-F


So it should be as simple as using
Code:
local addr = tonumber(f.Address[i],16)
Smile

Sorry 'bout that... it does tend to be the simple things that you forget Embarassed
Back to top
View user's profile Send private message
Post reviews:   Approve 1
Author Review
squerol
Review: Approve
Post reference:
ReviewPosted: Fri Jun 30, 2017 4:09 pm


Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites