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[edit]

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

Returns[edit]

The return value(s) of the given function.

Examples[edit]

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

See also[edit]