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 


(error) Attempt to compare number with userdata

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
TPRammus
Advanced Cheater
Reputation: 0

Joined: 05 Jan 2016
Posts: 61
Location: Germany

PostPosted: Fri Jun 24, 2016 8:16 am    Post subject: (error) Attempt to compare number with userdata Reply with quote

Hey!

I am getting this error:
Code:
Error:[string "AboutText=[[Trainer Trainer Trainer Train..."]:55: attempt to compare number with userdata

And this is line 55:
Code:
if ((getAddressList().getMemoryRecordByDescription("Code") > 999) & (getAddressList().getMemoryRecordByDescription("Code") < 10000)) then

Doesnt getAddressList().getMemoryRecordByDescription("Code") refer to a value?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4297

PostPosted: Fri Jun 24, 2016 9:01 am    Post subject: Reply with quote

No... getMemoryRecordByDescription returns a memory record (userdata). If you want the value property of it, append ".Value" at the end of it:
Code:
tonumber(getAddressList().getMemoryRecordByDescription("Code").Value) > 999


Please first refer to main.lua next time, as it usually has the answer you want.
main.lua wrote:
Addresslist Class
...
getMemoryRecordByDescription(description): returns a MemoryRecord object
main.lua wrote:
MemoryRecord Class:
The memoryrecord objects are the entries you see in the addresslist
...
Value: string - The value in stringform.
Also note that you should wrap the value in tonumber(arg) since the value is a string.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
TPRammus
Advanced Cheater
Reputation: 0

Joined: 05 Jan 2016
Posts: 61
Location: Germany

PostPosted: Fri Jun 24, 2016 11:13 am    Post subject: Reply with quote

Hey thanks it works fine!
ParkourPenguin wrote:
Please first refer to main.lua next time, as it usually has the answer you want.

Refer to main.lua? What do you mean with this? Is there a website for it or what?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4297

PostPosted: Fri Jun 24, 2016 11:17 am    Post subject: This post has 1 review(s) Reply with quote

main.lua is a file in the CE directory. It contains documentation on most functions, tables, classes, properties, etc. CE has available in Lua.

If you want to view the latest version online, look at GitHub.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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