MISC

CopyToClipboard

Copies text to the Windows clipboard.

Syntax

local ok, err = ONYX.CopyToClipboard(text)

Parameters

  • text (string) — Bytes to copy; terminated internally with NUL.

Return(s)

ok (boolean) — true on success; on error nil and a message.

Behavior

  • Uses OpenClipboard, EmptyClipboard and SetClipboardData with CF_TEXT.
  • ANSI only: non-ASCII characters may be mangled.
  • Returns an error when the clipboard is busy.

Example(s)

local ok, err = ONYX.CopyToClipboard("text 123")
if not ok then print("clipboard error", err) end