Context:getpaste

Reads text from a macOS paste event.

Syntax

Signature
Context:getpaste(Token: number) -> string

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
TokennumberCode from a macOS Paste event.

Returns

TypeDescription
stringPasted text, or an empty string when the token is unavailable.

Notes

The token works once and only for the context that received it. An invalid or already consumed token returns an empty string.

Example

Luau
local Context = input.createcontext()
for Tick = 1, 300 do
    Context:setcapture(true, false)
    for _, Event in Context:getevents() do
        if Event.Type == "Paste" then
            print(Context:getpaste(Event.Code))
        end
    end
    task.wait(1 / 60)
end
Context:destroy()