Difference between revisions of "Lua:getProcesslist"
Jump to navigation
Jump to search
m (Added CodeBox Template.) |
m |
||
| (3 intermediate revisions 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 | + | 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 | ||
| − | |||
| − | |||
| + | Format: ''%x - pidname'' | ||
=== Function Parameters === | === Function Parameters === | ||
| − | + | {|width="85%" cellpadding="5%" cellspacing="0" border="0" | |
| − | {|width="85 | ||
!align="left"|Parameter | !align="left"|Parameter | ||
!align="left"|Type | !align="left"|Type | ||
| Line 18: | Line 15: | ||
|Strings | |Strings | ||
|Strings | |Strings | ||
| − | | | + | |Optional. If provided, fills this Strings object with the process list. |
|} | |} | ||
| + | |||
| + | === Example === | ||
| + | <syntaxhighlight lang="lua" line highlight="2"> | ||
| + | -- Without Strings object | ||
| + | local plist = getProcesslist() | ||
| + | for pid, name in pairs(plist) do | ||
| + | print(string.format("0x%X - %s", pid, name)) | ||
| + | end | ||
| + | </syntaxhighlight> | ||
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
{{Process}} | {{Process}} | ||
Latest revision as of 19:20, 25 June 2026
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]
1 -- Without Strings object
2 local plist = getProcesslist()
3 for pid, name in pairs(plist) do
4 print(string.format("0x%X - %s", pid, name))
5 end