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 


Some experience and help needed ..

 
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: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Fri Aug 06, 2021 8:41 pm    Post subject: Some experience and help needed .. Reply with quote

I am trying to list all idioms used with CE.
But there are many idioms that I don't use or are not familiar with.
I need to list all of them.

Sample;
"string.byte"
"math max"
"os.execute"
"shellExsecute"
"io.popen"
...
etc

There are too many idioms and I need to list them.

It is not necessary for you to be familiar with it, I would be happy if you write it as a list so that there is no crowd of comments.

Thanks in advance.

_________________
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
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri Aug 06, 2021 9:39 pm    Post subject: Reply with quote

Most of that is in the Lua 5.3 Reference Manual.
http://www.lua.org/manual/5.3/contents.html#contents

shellExecute is a function CE provides and can be found in celua.txt.

_________________
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
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Fri Aug 06, 2021 11:04 pm    Post subject: Reply with quote

Even though I searched so much, it escaped my notice.
You made a great contribution, thank you @ParkourPenguin.

I started listing.

Code:
--strings
strings1=([["string.byte","string.char","string.ends","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.starts","string.sub","string.upper"]])

_________________
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
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Sat Aug 07, 2021 12:15 am    Post subject: Reply with quote

'string' is a built-in type/table to Lua, you can dump it if you want to see what all is in it like this:
Code:
for s in pairs(string) do
    print(s);
end

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Sat Aug 07, 2021 3:17 am    Post subject: Reply with quote

Also, in the Lua Engine window of Cheat Engine, you can press Ctrl + Spacebar to show a list of available methods/properties.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sat Aug 07, 2021 6:15 am    Post subject: Reply with quote

atom0s wrote:
'string' is a built-in type/table to Lua, you can dump it if you want to see what all is in it like this:
Code:
for s in pairs(string) do
    print(s);
end


Code:
for s in pairs(math) do
    print("math."..s);
end


Thanks.. The results are great. It works fine for "String" and "Math".
In addition to these, I need to list other manipulations used in CE.

Thanks to everyone who contributed.

_________________
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: 457

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

PostPosted: Sat Aug 07, 2021 10:41 am    Post subject: This post has 1 review(s) Reply with quote

don't forget string.split (CE addition to string)
_________________
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
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Sat Aug 07, 2021 10:42 pm    Post subject: Reply with quote

Aylin wrote:

Thanks.. The results are great. It works fine for "String" and "Math".
In addition to these, I need to list other manipulations used in CE.

Thanks to everyone who contributed.


If you are looking to dump all the base level tables that CE's Lua state contains, you can do that as well like this:
Code:

for k, v in pairs(_G) do
    if (v ~= nil and type(v) == 'table') then
        print(k);
        for kk, vv in pairs(v) do
            print(string.format('    - %s (%s)', kk, type(vv)));
        end
    end
    print('');
end


You can then rework it to do recursion as needed too if you want to dump inner-tables within those etc.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sun Aug 08, 2021 12:03 am    Post subject: Reply with quote

I think the reference is complete.
Your last contribution gave a long list, thanks.

Only one code left to complete the project.
When I get a response, I will integrate the project and present it.

When it is completed and in the final, I think a useful topic will come up again.
Thanks again.


----------------------------------
Irrelevant;
Why couldn't I leave a +1 for reputation?
I am getting an error message.
Is this a common situation?
----------------------------------

_________________
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
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Sun Aug 08, 2021 12:05 am    Post subject: Reply with quote

Code:

function print_table(node)
  local cache, stack, output = {},{},{}
  local depth = 1
  local output_str = "{\n"

  while true do
    local size = 0
    for k,v in pairs(node) do
      size = size + 1
    end

    local cur_index = 1
    for k,v in pairs(node) do
      if (cache[node] == nil) or (cur_index >= cache[node]) then

        if (string.find(output_str,"}",output_str:len())) then
          output_str = output_str .. ",\n"
        elseif not (string.find(output_str,"\n",output_str:len())) then
          output_str = output_str .. "\n"
        end

        -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings
        table.insert(output,output_str)
        output_str = ""

        local key
        if (type(k) == "number" or type(k) == "boolean") then
          key = "["..tostring(k).."]"
        else
          key = "['"..tostring(k).."']"
        end

        if (type(v) == "number" or type(v) == "boolean") then
          output_str = output_str .. string.rep('\t',depth) .. key .. " = "..tostring(v)
        elseif (type(v) == "table") then
          output_str = output_str .. string.rep('\t',depth) .. key .. " = {\n"
          table.insert(stack,node)
          table.insert(stack,v)
          cache[node] = cur_index+1
          break
        else
          output_str = output_str .. string.rep('\t',depth) .. key .. " = '"..tostring(v).."'"
        end

        if (cur_index == size) then
          output_str = output_str .. "\n" .. string.rep('\t',depth-1) .. "}"
        else
          output_str = output_str .. ","
        end
      else
        -- close the table
        if (cur_index == size) then
          output_str = output_str .. "\n" .. string.rep('\t',depth-1) .. "}"
        end
      end

      cur_index = cur_index + 1
    end

    if (size == 0) then
      output_str = output_str .. "\n" .. string.rep('\t',depth-1) .. "}"
    end

    if (#stack > 0) then
      node = stack[#stack]
      stack[#stack] = nil
      depth = cache[node] == nil and depth + 1 or depth - 1
    else
      break
    end
  end

  -- This is necessary for working with HUGE tables otherwise we run out of memory using concat on huge strings
  table.insert(output,output_str)
  output_str = table.concat(output)

  print(output_str)
end


You can also use this to print large and or nested tables.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sun Aug 08, 2021 12:23 am    Post subject: Reply with quote

@LeFiXER, thanks..

But it doesn't give the same result.
You need to get clean results.

Your code result:
Code:
{
   ['packsize'] = 'function: 00007FFEAC01A920',
   ['split'] = 'function: 000000000066E710',
   ['char'] = 'function: 00007FFEAC0174D0',
   ['byte'] = 'function: 00007FFEAC017330',
   ['gmatch'] = 'function: 00007FFEAC0189B0',
   ['gsub'] = 'function: 00007FFEAC018FC0',
...
...


And look at this example;
Code:
for s in pairs(string) do
    --print("string."..s);
    print("string."..s.."()");
end


result:
Code:
string.packsize()
string.split()
string.char()
string.byte()
string.gmatch()
string.gsub()
string.find()
string.match()
string.dump()
string.len()
string.gfind()
string.sub()
...
...


"The shortest way you can walk,
He gives you the remaining time as a gift." Wink

Always; I am fascinated by the magic of shortcodes.

Thanks for the contribution.

_________________
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
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Sun Aug 08, 2021 2:16 am    Post subject: Reply with quote

Indeed, shorthand is nice but can lose all contextual brevity, at least without comments, as when you later return to it you may not remember what the purpose of the code was for. Nevertheless, I think it helps to share the myriad ways of doing things.
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