love.system.setClipboardText (日本語)

LÖVE 0.9.0 から使用可能
この関数は以前のバージョンでは非対応です。

クリップボードへテキストを出力します。

関数

概要

love.system.setClipboardText( text )

引数

string text
システムのクリップボードへ保持を行う新規テキスト。

返値

ありません。

用例

コピーペーストバッファにオペレーティングシステムのアゴニスティック・キーバインディングに設定します。

local buffer

function love.draw()

  love.graphics.print(
    "OS: "..love.system.getOS().."\n"..
    "Local buffer: "..tostring(buffer).."\n"..
    "System buffer: "..tostring(love.system.getClipboardText()))

end

function love.keypressed(key)

  local osString = love.system.getOS()

  local control

  if osString == "OS X" then
    control = love.keyboard.isDown("lgui","rgui")
  elseif osString == "Windows" or osString == "Linux" then
    control = love.keyboard.isDown("lctrl","rctrl")
  end

  if control then
    if key == "c" then
      if buffer then love.system.setClipboardText(buffer) end
    end
    if key == "v" then
      buffer = love.system.getClipboardText()
    end
  end

end

返値


そのほかの言語