View previous topic :: View next topic |
Author |
Message |
HenryEx Expert Cheater
Reputation: 2
Joined: 18 Dec 2011 Posts: 100
|
Posted: Tue Jan 28, 2025 12:04 pm Post subject: decodeFunction() result can't call other decoded func? |
|
|
Trying to mess around with encodeFunction and decodeFunction, but i'm not having a lot of luck.
I wrote a lua function to update a mono-derived CE structure with new offsets and fields, without creating a new one and getting rid of all the changes you might have made to the existing one (pointers, local structs etc.).
This is meant to be a versatile all-purpose function.
Then i wrote a second, smaller function to automatically go over all CE structs, check if they correspond to a mono class, update them via the previous function and report on the results.
If i encode these two functions and then run this through lua:
Code: | local func1 = '[ENCODED FUNCTION 1 HERE]'
local updateStructFromMonoClass = decodeFunction(func1)
local func2 = '[ENCODED FUNCTION 2 HERE]'
local updateAllMonoStructs = decodeFunction(func2)
updateAllMonoStructs() |
It results in the following:
Code: | Error:?:-1: attempt to call a nil value (field 'updateStructFromMonoClass')
Script Error |
Can a decoded function not call other decoded functions? That would be incredibly restrictive. Or maybe i'm just missing something obvious.
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 468
Joined: 09 May 2003 Posts: 25706 Location: The netherlands
|
Posted: Tue Jan 28, 2025 12:13 pm Post subject: |
|
|
remove local from updateStructFromMonoClass else the other script which is loaded in a different context can't see it
_________________
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 |
|
 |
HenryEx Expert Cheater
Reputation: 2
Joined: 18 Dec 2011 Posts: 100
|
Posted: Tue Jan 28, 2025 12:31 pm Post subject: |
|
|
I see. Not too familiar with context windows for LUA, since all i know about it is from CE and googling what i need to make tables.
I'm assuming this would make it a global function for however long that instance of Cheat Engine exists? Not that i would expect a lot of name collisions, but that would override any previously existing functions with the same name? (from autoruns for example)
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 468
Joined: 09 May 2003 Posts: 25706 Location: The netherlands
|
Posted: Tue Jan 28, 2025 12:39 pm Post subject: |
|
|
yes.You can of course use a luatable unique to your project and put the functions in there
e.g:
Code: |
myuniquelib={}
local func1 = '[ENCODED FUNCTION 1 HERE]'
myuniquelib.updateStructFromMonoClass = decodeFunction(func1)
local func2 = '[ENCODED FUNCTION 2 HERE]'
myuniquelib.updateAllMonoStructs = decodeFunction(func2)
myuniquelib.updateAllMonoStructs()
|
of course adjust updateAllMonoStructs to call myuniquelib.updateStructFromMonoClass instead
_________________
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 |
|
 |
HenryEx Expert Cheater
Reputation: 2
Joined: 18 Dec 2011 Posts: 100
|
Posted: Wed Jan 29, 2025 2:07 pm Post subject: |
|
|
Thank you for the speedy help!
|
|
Back to top |
|
 |
|