Difference between revisions of "Lua:getOpenedProcessID"
Jump to navigation
Jump to search
m (Added CodeBox Template.) |
m (Syntax Highlighting.) |
||
| Line 16: | Line 16: | ||
===Examples=== | ===Examples=== | ||
| − | < | + | <syntaxhighlight lang="lua" line> |
local pid = getOpenedProcessID() | local pid = getOpenedProcessID() | ||
if pid ~= 0 then | if pid ~= 0 then | ||
| Line 29: | Line 29: | ||
print("No process is currently open.") | print("No process is currently open.") | ||
end | end | ||
| − | </ | + | </syntaxhighlight> |
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
{{Process}} | {{Process}} | ||
Latest revision as of 19:09, 25 June 2026
Returns the process ID of the currently opened process in Cheat Engine. If no process is open, returns 0.
Note: getOpenedProcessID() does not return 0 after a process was closed. It will still return the previous ID, even if the process has been terminated. To check if the process is still available, use readInteger(process).
Function Parameters[edit]
<none>
Returns[edit]
Integer — The process ID of the currently opened process, or 0 if none.
Examples[edit]
1 local pid = getOpenedProcessID()
2 if pid ~= 0 then
3 print("Current process ID:", pid)
4 local check = readInteger(process)
5 if check == pid then
6 print("Process is still the same and available.")
7 else
8 print("Process has changed or is no longer available.")
9 end
10 else
11 print("No process is currently open.")
12 end