Code Monkey home page Code Monkey logo

lovr-clipboard's Introduction

lovr-clipboard

Clipboard module for LÖVR that leverages GLFW through LuaJIT's FFI.

Usage

-- Require the module so we can deal with the Clipboard.
lovr.clipboard = require("lovr-clipboard")

local text = nil

function lovr.load()  
  -- Copy text "Hello, Clipboard!" to the Clipboard.
  local success, error_code, error_message = lovr.clipboard.set("Hello, Clipboard!")
  
  -- If no error occurred then retrieve the text from the Clipboard as string.
  if success then
    text, error_code, error_message = lovr.clipboard.get()
  end
  
  -- If error occurred then set the text to the error message.
  if ((not success) or (text == nil)) then
    text = error_message
  end
end

function lovr.draw()
  -- Draws text copied to the Clipboard if success, Or draws the error message if error has occurred.
  lovr.graphics.print(text, 0, 0, -5, 0.5)
end

Check out the API for more informations on using the library.

Support and Troubleshooting

  1. If LÖVR throws error due to missing procedure(s) then replace the shared library of GLFW (Which comes along LÖVR files) with the latest one from GLFW Downloads

  2. As of the latest commit, The annotations for Lua Language Server is provided so it will help in case you are using Visual Studio Code

  3. If you want to use lovr-clipboard outside of LÖVR within another Lua game engine/framework that leverages GLFW then it's possible, Keep in mind that you are calling the functions after initializing GLFW and without dereferencing via lovr.

License

MIT, Check LICENSE.txt for the license.

lovr-clipboard's People

Contributors

rabios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.