clipboard
Description
ComputerCraft OS
Installation
Copy one of these commands into your ComputerCraft terminal:
wget:
wget https://raw.githubusercontent.com/kepler155c/opus/develop-1.8/sys/autorun/clipboard.lua clipboardArchive:
wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-autorun-clipboard clipboard
Quick Install:
wget https://cc.shobie.xyz/cc/get/gh-kepler155c-opus-sys-autorun-clipboard clipboard
Usage
Run: clipboard
Tags
Source
View Original SourceCode Preview
local Util = require('opus.util')
local kernel = _G.kernel
local keyboard = _G.device.keyboard
local os = _G.os
local textutils = _G.textutils
kernel.hook('clipboard_copy', function(_, args)
keyboard.clipboard = args[1]
end)
local function queuePaste()
local data = keyboard.clipboard
if type(data) == 'table' then
local s, m = pcall(textutils.serialize, data)
data = s and m or Util.tostring(data)
end
if data then
os.queueEvent('paste', data)
end
end
kernel.hook('clipboard_paste', queuePaste)
keyboard.addHotkey('shift-paste', queuePaste)