Difference between revisions of "Lua:encodeFunctionEx"
Jump to navigation
Jump to search
m (Syntax Highlighting.) |
m (Added related function template.) |
||
| Line 86: | Line 86: | ||
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
| − | {{ | + | {{EncodeDecode}} |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | }} | ||
Latest revision as of 00:10, 27 June 2026
Converts a Lua script string into an encoded function string.
This is similar to encodeFunction, but it uses a script string instead of a function object and allows specifying which Lua DLL should be used.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| string | String | The Lua script that should be encoded. |
| pathtodll | String (optional) | The path to the Lua DLL that should be used for encoding. |
Returns[edit]
String — The encoded function string.
Architecture Compatibility[edit]
The Lua DLL must match the architecture of the current Cheat Engine process.
| Current Process | Allowed Lua DLL | Result |
|---|---|---|
| 32-bit Cheat Engine | 32-bit Lua DLL | Compatible. |
| 64-bit Cheat Engine | 64-bit Lua DLL | Compatible. |
| 32-bit Cheat Engine | 64-bit Lua DLL | Not compatible. |
| 64-bit Cheat Engine | 32-bit Lua DLL | Not compatible. |
Examples[edit]
1 local encoded = encodeFunctionEx([[
2 print("Hello from an encoded script")
3 ]])
4
5 local decoded = decodeFunction(encoded)
6 decoded()
1 local script = [[
2 return function(value)
3 return value * 2
4 end
5 ]]
6
7 local encoded = encodeFunctionEx(script)
8 local decoded = decodeFunction(encoded)
9
10 local fn = decoded()
11 print(fn(21))
1 local luaDllPath = "C:\\\\Cheat Engine\\\\lua53-64.dll"
2
3 local encoded = encodeFunctionEx([[
4 print("Encoded with a specific Lua DLL")
5 ]], luaDllPath)
6
7 local decoded = decodeFunction(encoded)
8 decoded()