Difference between revisions of "Lua:onOpenProcess"

From Cheat Engine
Jump to navigation Jump to search
m
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''event''' onOpenProcess(''processId'')
+
{{CodeBox|'''event''' onOpenProcess(''processId'')}}
  
 
If this function is defined it will be called whenever cheat engine opens a process.
 
If this function is defined it will be called whenever cheat engine opens a process.
:Note: The same process might be opened multiple times in a row internally
+
:'''Note''': The same process might be opened multiple times in a row internally
:Note: This function is called before attachment is fully done. You can call reinitializeSymbolhandler() to force the open to complete, but it will slow down process opens. Alternatively, you could launch a timer which will run when the opening has finished
+
:'''Note''': This function is called before attachment is fully done. You can call reinitializeSymbolhandler() to force the open to complete, but it will slow down process opens. Alternatively, you could launch a timer which will run when the opening has finished
  
 
===Function Parameters===
 
===Function Parameters===
Line 18: Line 18:
  
 
== Examples ==
 
== Examples ==
<pre>
+
<syntaxhighlight lang="lua" line>
 
function onOpenProcess(processId)
 
function onOpenProcess(processId)
 
     print(string.format('Process opened: %d', processId))
 
     print(string.format('Process opened: %d', processId))
 
end
 
end
</pre>
+
</syntaxhighlight>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}
  
=== Related Functions ===
+
{{Process}}
* [[Lua:openProcess|openProcess]]
 
* [[Lua:getProcesslist|getProcesslist]]
 
* [[Lua:getOpenedProcessID|getOpenedProcessID]]
 
* [[Lua:getProcessIDFromProcessName|getProcessIDFromProcessName]]
 
* [[Lua:createProcess|createProcess]]
 
* [[Lua:openFileAsProcess|openFileAsProcess]]
 

Latest revision as of 19:08, 25 June 2026

<> Lua API Reference

event onOpenProcess(processId)

If this function is defined it will be called whenever cheat engine opens a process.

Note: The same process might be opened multiple times in a row internally
Note: This function is called before attachment is fully done. You can call reinitializeSymbolhandler() to force the open to complete, but it will slow down process opens. Alternatively, you could launch a timer which will run when the opening has finished

Function Parameters[edit]

Parameter Type Description
processId number The ID of the process that was opened

Examples[edit]

1 function onOpenProcess(processId)
2     print(string.format('Process opened: %d', processId))
3 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Process Open / Creation

Process Lists / Modules

Process Control / Target State