Skip to content

clipboard

The clipboard namespace provides access to the operating system clipboard.


Function Parameters Returns Description
clipboard.get (none) string | nil Reads text from the system clipboard. Returns nil if empty or non-text.
clipboard.set text: string boolean Writes text to the system clipboard. Returns true on success.
clipboard.paste (none) string | nil Alias for clipboard.get().
clipboard.copy text: string boolean Alias for clipboard.set(text).

local group = ui.groupbox("Settings", "Share Config")
local copy_btn = group:button("Copy Config to Clipboard")
copy_btn:set_callback(function()
local payload = json.stringify({
fov = 120,
bhop = true,
smooth = 0.5
})
if clipboard.set(payload) then
print("Config successfully copied to clipboard!")
end
end)