Lua:synchronize

From Cheat Engine
Revision as of 00:37, 11 July 2025 by Leunsel (talk | contribs) (Created page with "Category:Lua '''function''' synchronize(''Function'', ...) ''':''' any Calls the given function from the main thread, passing any additional arguments. Returns the retu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

function synchronize(Function, ...) : any

Calls the given function from the main thread, passing any additional arguments. Returns the return value(s) of the given function.

Function Parameters

Parameter Type Description
Function Function The function to execute in the main thread.
... Any Optional arguments to pass to the function.

Returns

The return value(s) of the given function.

Examples

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

See also