Paste (event)

From ComputerCraft Wiki
Jump to: navigation, search



Grid Modem.png  Event char
Fired when Ctrl + V is pressed on the keyboard, assuming pastable text exists in the system clipboard. The clipboard accessed belongs to the OS within which MineCraft itself is running.

Prior to ComputerCraft 1.6, instead of queuing a "paste" event Ctrl + V triggers a series of char events representing the text. Unlike regular char events, these are not preceeded by key events.

Either way, only the first line of text is returned: subsequent content after the first line break is not accessible. Note that Ctrl + V generates no events at all if the clipboard does not contain pastable text - the key combo itself is invisible to ComputerCraft scripts, and only the "result" can be seen.
Returned Object 1 string system clipboard text


Grid paper.png  Example
Prints out pasted text.
Code
while true do
  local event, pasted = os.pullEvent("paste")
  print("Pasted text: " .. pasted)
end
Output With each press of Ctrl + V, displays the first line of text in the system's clipboard.



Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox