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 


AOBScan returning nil

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
lightersmasher
How do I cheat?
Reputation: 0

Joined: 24 Jul 2022
Posts: 1
Location: United States

PostPosted: Sun Jul 24, 2022 9:47 pm    Post subject: AOBScan returning nil Reply with quote

Hi

Whenever I try to use the AOBScan function in the Lua Engine, it is only returning nil. Here is my code:

Code:
util.aobscan = function(aob)
    local results = AOBScan(aob, "-C-W", 0, "")
    print(type(results))
    local new_results = {};

    for i = 0,results.Count - 1 do
        table.insert(new_results, getAddress(results[i]));
    end

    return new_results;
end


Whenever I use it, it prints "nil" and then errors. Why is this happening?[/quote]
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Sun Jul 24, 2022 9:55 pm    Post subject: Reply with quote

If the pattern can't be found, AOBScan returns nil.

This returns an empty table:
Code:
util.aobscan = function(aob)
  local results = AOBScan(aob, "+X-C-W")
  local new_results = {}

  if results then
    for i = 0, results.Count - 1 do
      table.insert(new_results, getAddress(results[i]))
    end
  end

  return new_results
end

_________________
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