M MY Multiplayer: Wiki
Side
Kind

async.yield

Shared

Pauses the current async thread until the scripts' next update, to split long work into pieces.

nil|false async.yield()

Returns

Nothing when the thread resumes. Only works inside an async thread. Outside one, it logs an error and returns false.

Example

async.thread(function()
    for i, vehicle in ipairs(getElementsByType("vehicle")) do
        setElementData(vehicle, "checked", true)
        if i % 100 == 0 then
            async.yield()
        end
    end
end)

See also