Difference between revisions of "Lua:inMainThread"

From Cheat Engine
Jump to navigation Jump to search
(Created page with "Category:Lua '''function''' inMainThread() ''':''' Boolean Returns true if the current code is running inside the main thread. Available in Cheat Engine 6.4 and later....")
 
Line 1: Line 1:
 
[[Category:Lua]]
 
[[Category:Lua]]
 +
{{VersionNotice|6.4+}}
 
'''function''' inMainThread() ''':''' Boolean
 
'''function''' inMainThread() ''':''' Boolean
  

Revision as of 19:03, 4 December 2025

⚠️ Version Notice

This function requires Cheat Engine 6.4+.

function inMainThread() : Boolean

Returns true if the current code is running inside the main thread. Available in Cheat Engine 6.4 and later.

Function Parameters

None.

Returns

Boolean — true if running in the main thread, false otherwise.

Examples

function ShowError(message)
    if not inMainThread() then
        synchronize(function()
            self:ShowError(message)
        end)
        return
    end
    messageDialog(message, mtError, mbOK)
end

See also