Difference between revisions of "Lua:process"
Jump to navigation
Jump to search
(→Related Variables) |
|||
| Line 8: | Line 8: | ||
== Examples == | == Examples == | ||
| − | |||
| − | |||
When '''not attached''' to any process: | When '''not attached''' to any process: | ||
Code: | Code: | ||
| − | + | print(type(process)) | |
| − | + | print(process) | |
| − | + | print('Attached to ' .. (process or 'NOTHING')) | |
| − | + | if process then | |
| − | + | print('attached') | |
| − | + | else | |
| − | + | print('Not Attached') | |
| − | + | end | |
Output: | Output: | ||
| − | + | nil | |
| − | + | | |
| − | + | Attached to NOTHING | |
| − | + | Not Attached | |
| − | + | With the same code as above and '''attached''' to the '''''Cheat Engine Tutorial (64-Bit)''''': | |
| + | Output: | ||
| + | string | ||
| + | Tutorial-x86_64.exe | ||
| + | Attached to Tutorial-x86_64.exe | ||
| + | attached | ||
| − | + | Note: If attached, and the attached process closes the "process" variable will still contain the last attached process' main module name. But "readInteger(process)" can be used. | |
| + | if process ~= nil and readInteger(process) ~= nil then | ||
| + | print('Attached to ' .. process) | ||
| + | end | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
== See also == | == See also == | ||
Revision as of 04:15, 25 January 2018
global variable process
type (nil, string)
A variable that contains the main module name of the currently opened process
Examples
When not attached to any process:
Code:
print(type(process))
print(process)
print('Attached to ' .. (process or 'NOTHING'))
if process then
print('attached')
else
print('Not Attached')
end
Output:
nil Attached to NOTHING Not Attached
With the same code as above and attached to the Cheat Engine Tutorial (64-Bit):
Output:
string Tutorial-x86_64.exe Attached to Tutorial-x86_64.exe attached
Note: If attached, and the attached process closes the "process" variable will still contain the last attached process' main module name. But "readInteger(process)" can be used.
if process ~= nil and readInteger(process) ~= nil then
print('Attached to ' .. process)
end