Lua:synchronize

From Cheat Engine
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