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 


Is there a technical way to index pointers?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1543

PostPosted: Thu Jan 15, 2026 5:04 pm    Post subject: Is there a technical way to index pointers? Reply with quote

Here's a question for those using pointers! (I'm not very familiar with pointers, as I'm more interested in the Lua side of CE.)

There are 2 possible outcomes a user might want:

Code:
-- Scenario 1:
[[[executable.exe+00A1B2C3]+10D2SC]+20]+30

-- Scenario 2:
[[[[executable.exe]+00A1B2C3]+10D2SC]+20]+30


But all we have is the plain text:
Code:
executable.exe+00A1B2C3+10D2SC+20+30


Now the question is:

What is the correct approach to sum this up and wrap it in square brackets? (readPointer(executable.exe+00A1B2C3) or another approach...)

I could try parsing it superficially with Lua:

Code:
input = 'executable.exe+00A1B2C3+10D2SC+20+30'
local bs = ""
local firstPart = true
  for p in input:gmatch("[^%+]+") do
    if firstPart then
      if #p>5 then
        if bs=="" then bs=p else firstPart=false p=bs.."+"..p print(p)  end
      end
    else
      print(p)
    end
  end


result:
Code:
executable.exe+00A1B2C3
10D2SC
20
30


But I'm not sure about its accuracy, or this variation will backfire if there are more than 6 inputs.

Is there a more technical way to properly parse this?

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25861
Location: The netherlands

PostPosted: Thu Jan 15, 2026 6:08 pm    Post subject: Reply with quote

if the user enters it as "executable.exe+00A1B2C3+10D2SC+20+30" then it's up to you to handle it the way you wish as there's no design for strings like that except just addition calculation
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1543

PostPosted: Thu Jan 15, 2026 8:15 pm    Post subject: Reply with quote

Ah... I'll choose this one. This is wonderful! Cool

Since there's no formal design for parsing plain text strings, I implemented logic that treats 'Module + Initial Offset' as a single Base unit when a module extension (.exe/.dll) is detected.

This can prevent the static offset from being treated as a dynamic pointer offset in the Address List.

Code:
--- Technically safest way to parse plain strings without formal brackets.
-- Standardizes: Module+Offset as a single Base unit.
function parsePlainPointer(input)
    local parts = {}
    local temp = {}
    for p in input:gmatch("[^%+]+") do table.insert(temp, p) end

    -- DarkByte's Choice: How to decide what is 'Base' vs 'Offset'?
    -- Decision: If part 1 is a module OR part 2 is a static-sized Hex, they are the Base.
    if #temp >= 2 and (temp[1]:find("%.") or #temp[2] > 5) then
        table.insert(parts, temp[1] .. "+" .. temp[2]) -- Married Base
        for i = 3, #temp do table.insert(parts, temp[i]) end
    else
        table.insert(parts, temp[1]) -- Simple Base
        for i = 2, #temp do table.insert(parts, temp[i]) end
    end
    return parts
end


Final Module:
https://forum.cheatengine.org/viewtopic.php?p=5794483

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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