Difference between revisions of "Lua:inMainThread"
Jump to navigation
Jump to search
m (Added related function template.) |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Lua]] | [[Category:Lua]] | ||
{{VersionNotice|6.4+}} | {{VersionNotice|6.4+}} | ||
| − | '''function''' inMainThread() ''':''' | + | {{CodeBox|'''function''' inMainThread() ''':''' boolean}} |
| − | Returns true if the current code is running inside the main thread. | + | Returns true if the current code is running inside the main thread. |
| − | + | ||
| + | This function is available in Cheat Engine 6.4 and later. | ||
===Function Parameters=== | ===Function Parameters=== | ||
| − | + | This function has no parameters. | |
===Returns=== | ===Returns=== | ||
| − | + | boolean — True if the current code is running inside the main thread, otherwise false. | |
===Examples=== | ===Examples=== | ||
| − | < | + | <syntaxhighlight lang="lua" line> |
| − | + | if inMainThread() then | |
| − | + | print("Running in the main thread") | |
| − | + | else | |
| − | + | print("Not running in the main thread") | |
| − | |||
| − | |||
| − | |||
| − | |||
end | end | ||
| − | </ | + | </syntaxhighlight> |
| + | |||
| + | {{LuaSeeAlso}} | ||
| − | + | {{Threads}} | |
| − | |||
| − | |||
Latest revision as of 20:53, 26 June 2026
Returns true if the current code is running inside the main thread.
This function is available in Cheat Engine 6.4 and later.
Function Parameters[edit]
This function has no parameters.
Returns[edit]
boolean — True if the current code is running inside the main thread, otherwise false.
Examples[edit]
1 if inMainThread() then
2 print("Running in the main thread")
3 else
4 print("Not running in the main thread")
5 end