pasteboard.copy()

Type function
Return value none
Revision Release 2024.3703
Keywords copy, pasteboard
See also Pasteboard
pasteboard.paste()
pasteboard.clear()

Overview

Copies a string, URL, or image to the device pasteboard.

Gotchas

Image copying/pasting is only supported on iOS.

Syntax

pasteboard.copy( copyType, string )
pasteboard.copy( copyType, url )
pasteboard.copy( copyType, fileName, baseDir ) 
copyType (required)

String. The type of data to copy to the pasteboard. Valid options include "string", "url", or "image".

string (optional)

String. The string you wish to copy to the pasteboard. Applies only if copyType is "string".

url (optional)

String. The URL you wish to copy to the pasteboard. Applies only if copyType is "url".

fileName (optional)

String. The file name of the image you wish to copy to the pasteboard. Applies only if copyType is "image". Note that image copying/pasting is only supported on iOS.

baseDir (optional)

Constant. The system path to load the image from. Applies only if copyType is "image". Note that image copying/pasting is only supported on iOS.

Example

local pasteboard = require( "plugin.pasteboard" )

pasteboard.copy( "string", "Hello World!" )