Difference between revisions of "Lua:openProcess"

From Cheat Engine
Jump to navigation Jump to search
m (Syntax Highlighting.)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''function''' openProcess(''processname'')<br>
+
[[Category:Lua]]
'''function''' openProcess(''processid'')
+
{{CodeBox|'''function''' openProcess(''ProcessID'')}}
 
+
{{CodeBox|'''function''' openProcess(''ProcessName'')}}
 
 
 
 
Causes cheat engine to open the provided processname or processid.
 
 
 
Please note that if you provide an integer in the form of a string openProcess will look for a process that has as name the specified number. Provide an integer if you wish to specify the PID.
 
 
 
Example:
 
  openProcess("game.exe")
 
  openProcess(7890)
 
  openProcess(tonumber("7890"))
 
  
 +
Opens the specified process in Cheat Engine, either by process ID or by process name. 
 +
This sets the target process for memory editing and scanning.
  
 
===Function Parameters===
 
===Function Parameters===
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
 
!style="width: 80%;background-color:white;" align="left"|Description
 
!style="width: 80%;background-color:white;" align="left"|Description
 
|-
 
|-
|processname
+
|ProcessID
 +
|Integer
 +
|The ID of the process to open.
 +
|-
 +
|ProcessName
 
|String
 
|String
|The processname to find and open
+
|The name of the process to find and open (e.g., "notepad.exe").
|-
 
|processid
 
|integer
 
|The processID to find and open
 
 
|}
 
|}
  
 +
===Examples===
 +
<syntaxhighlight lang="lua" line>
 +
-- Open a process by name
 +
openProcess("notepad.exe")
 +
 +
-- Open a process by ID
 +
local pid = getProcessIDFromProcessName("notepad.exe")
 +
if pid then
 +
  openProcess(pid)
 +
end
 +
</syntaxhighlight>
 +
 +
{{LuaSeeAlso}}
  
== See also ==
+
{{Process}}
* [[Lua]]
 

Latest revision as of 19:08, 25 June 2026

<> Lua API Reference

function openProcess(ProcessID)

<> Lua API Reference

function openProcess(ProcessName)

Opens the specified process in Cheat Engine, either by process ID or by process name. This sets the target process for memory editing and scanning.

Function Parameters[edit]

Parameter Type Description
ProcessID Integer The ID of the process to open.
ProcessName String The name of the process to find and open (e.g., "notepad.exe").

Examples[edit]

1 -- Open a process by name
2 openProcess("notepad.exe")
3 
4 -- Open a process by ID
5 local pid = getProcessIDFromProcessName("notepad.exe")
6 if pid then
7   openProcess(pid)
8 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Process Open / Creation

Process Lists / Modules

Process Control / Target State