Difference between revisions of "Lua:getProcesslist"

From Cheat Engine
Jump to navigation Jump to search
m (Reverted edits by This content is not available (Talk) to last revision by TheyCallMeTim13)
m (Added CodeBox Template.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
'''function''' getProcesslist(''Strings'' OPTIONAL) ''':''' table '''-''' Strings
+
{{CodeBox|'''function''' getProcesslist(''Strings'' OPTIONAL) ''':''' table '''-''' Strings}}
  
Returns a table with the processlist (pid - name ), if 'Strings' is not set.
+
Returns a table with the process list (PID → name) if ''Strings'' is not set.
 
+
If ''Strings'' is provided, it fills the given ''Strings'' object with the system's process list.
If 'Strings' is set fills a Strings inherited object with the process list of the system.
 
 
 
Format: %x-pidname
 
  
 +
Format: ''%x - pidname''
  
 
=== Function Parameters ===
 
=== Function Parameters ===
 
+
{|width="85%" cellpadding="5%" cellspacing="0" border="0"
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
 
 
!align="left"|Parameter
 
!align="left"|Parameter
 
!align="left"|Type
 
!align="left"|Type
Line 18: Line 15:
 
|Strings
 
|Strings
 
|Strings
 
|Strings
|Set optionaly to the Strings object to fill
+
|Optional. If provided, fills this Strings object with the process list.
 
|}
 
|}
  
 +
=== Example ===
 +
<pre>
 +
-- Without Strings object
 +
local plist = getProcesslist()
 +
for pid, name in pairs(plist) do
 +
  print(string.format("0x%X - %s", pid, name))
 +
end
 +
 +
-- Using Strings object
 +
local strObj = Strings.create()
 +
getProcesslist(strObj)
 +
print(strObj:ToTable())
 +
</pre>
  
== See also ==
+
{{LuaSeeAlso}}
* [[Lua]]
 
* [[Help_File:Script engine|Script engine]]
 
  
=== Related Functions ===
+
{{Process}}
* [[Lua:getOpenedProcessID|getOpenedProcessID]]
 
* [[Lua:getProcessIDFromProcessName|getProcessIDFromProcessName]]
 
* [[Lua:createProcess|createProcess]]
 
* [[Lua:openProcess|openProcess]]
 

Latest revision as of 00:52, 5 December 2025

<> Function

function getProcesslist(Strings OPTIONAL) : table - Strings

Returns a table with the process list (PID → name) if Strings is not set. If Strings is provided, it fills the given Strings object with the system's process list.

Format: %x - pidname

Function Parameters[edit]

Parameter Type Description
Strings Strings Optional. If provided, fills this Strings object with the process list.

Example[edit]

-- Without Strings object
local plist = getProcesslist()
for pid, name in pairs(plist) do
  print(string.format("0x%X - %s", pid, name))
end

-- Using Strings object
local strObj = Strings.create()
getProcesslist(strObj)
print(strObj:ToTable())

See also[edit]

Lua
Script Engine

Related Functions[edit]

createProcess
openProcess
onOpenProcess
getForegroundProcess
getOpenedProcessID
getProcessIDFromProcessName
openFileAsProcess
saveOpenedFile
setPointerSize
setAssemblerMode
getProcesslist
getWindowlist
pause
unpause
targetIs64Bit
enumModules
closeRemoteHandle