Difference between revisions of "Lua:process"

From Cheat Engine
Jump to navigation Jump to search
m (Reverted edits by This content is not available (Talk) to last revision by TheyCallMeTim13)
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== process ==
+
[[Category:Lua]]
 +
'''global variable''' process
  
 +
'''type''' (nil, string)
  
 
+
A variable that contains the main module name of the currently opened process
; process
 
: A variable that contains the main module name of the currently opened process
 
 
 
 
 
-----------------------------------------
 
  
  
 +
== Examples ==
 
When '''not attached''' to any process:
 
When '''not attached''' to any process:
  
 
Code:
 
Code:
  print(type(process))
+
print(type(process))
  print(process)
+
print(process)
  print('Attached to ' .. (process or 'NOTHING'))
+
print('Attached to ' .. (process or 'NOTHING'))
  if process then
+
if process then
    print('attached')
+
  print('attached')
  else
+
else
    print('Not Attached')
+
  print('Not Attached')
  end
+
end
 
Output:
 
Output:
  nil  
+
nil  
   
+
 
  Attached to NOTHING  
+
Attached to NOTHING  
  Not Attached
+
Not Attached
 
 
Note: If attached, and the attached process closes the "process" variable will still contain the last attached process' main module name.
 
 
 
  
 
With the same code as above and '''attached''' to the '''''Cheat Engine Tutorial (64-Bit)''''':
 
With the same code as above and '''attached''' to the '''''Cheat Engine Tutorial (64-Bit)''''':
  
 
Output:
 
Output:
  string  
+
string  
  Tutorial-x86_64.exe  
+
Tutorial-x86_64.exe  
  Attached to Tutorial-x86_64.exe  
+
Attached to Tutorial-x86_64.exe  
  attached  
+
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
  
=== Links ===
 
  
 +
== See also ==
 
* [[Lua]]
 
* [[Lua]]
 
* [[Help_File:Script_engine|Script engine]]
 
* [[Help_File:Script_engine|Script engine]]
  
==== Variables ====
+
=== Related Variables ===
* [[dbk_NtOpenProcess]]
+
* [[Lua:dbk_NtOpenProcess|dbk_NtOpenProcess]]
 +
* [[Lua:TrainerOrigin|TrainerOrigin]]
  
==== Functions ====
+
=== Related Functions ===
* [[getProcesslist]]
+
* [[Lua:getProcesslist|getProcesslist]]
* [[getWindowlist]]
+
* [[Lua:getOpenedProcessID|getOpenedProcessID]]
* [[getOpenedProcessID]]
+
* [[Lua:getProcessIDFromProcessName|getProcessIDFromProcessName]]
* [[getProcessIDFromProcessName]]
+
* [[Lua:openProcess|openProcess]]
* [[openProcess]]
+
* [[Lua:getForegroundProcess|getForegroundProcess]]
* [[getForegroundProcess]]
+
* [[Lua:getWindowProcessID|getWindowProcessID]]
* [[getWindowProcessID]]
+
* [[Lua:createProcess|createProcess]]
* [[createProcess]]
+
* [[Lua:debugProcess|debugProcess]]
* [[debugProcess]]
+
* [[Lua:dbk_useKernelmodeOpenProcess|dbk_useKernelmodeOpenProcess]]
* [[dbk_useKernelmodeOpenProcess]]
+
* [[Lua:dbk_useKernelmodeProcessMemoryAccess|dbk_useKernelmodeProcessMemoryAccess]]
* [[dbk_useKernelmodeProcessMemoryAccess]]
+
* [[Lua:dbk_getPEProcess|dbk_getPEProcess]]
* [[dbk_getPEProcess]]
 

Latest revision as of 19:08, 18 March 2019

global variable process

type (nil, string)

A variable that contains the main module name of the currently opened process


Examples[edit]

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


See also[edit]

Related Variables[edit]

Related Functions[edit]