setclipboard Synchronous

  • Clipboard.set
  • setrbxclipboard
  • syn.write_clipboard
  • toclipboard

Copy a value to the Android clipboard as text, ready to paste into another app. This is handy for an export code, a result, or a short diagnostic without converting it yourself first.

Syntax
Luau
setclipboard(data: any) -> ()

Parameters

Function parameters
ParameterTypeDescription
dataanyValue to convert to text and copy. Strings, numbers, booleans, nil, functions, threads, and values with __tostring are accepted.

Returns

()

No values.

Usage notes

Kawaii converts the value with Luau’s tostring behavior, including a table or userdata __tostring metamethod. Passing nil copies its text representation; leaving out the argument raises an error.

The copied text replaces the current clipboard contents.

Example

Example
Luau
local result = { code = "EXAMPLE-1234" }
setmetatable(result, {
    __tostring = function(self)
        return self.code
    end,
})
setclipboard(result)
print("Code copied to clipboard")