Context:getpaste
Reads text from a macOS paste event.
Syntax
Signature
Context:getpaste(Token: number) -> stringAliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Token | number | Code from a macOS Paste event. |
Returns
| Type | Description |
|---|---|
string | Pasted 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()