Jump to content

Lua Windows API -- Clipboard?


MaxAigner
 Share

Recommended Posts

You can try this:

https://github.com/luapower/winapi/blob/master/winapi/clipboard.lua

but you probably need to disable the Lua Sandbox in the Editor and you will not be able to use this in the Leadwerks Game Launcher.

 

Or i can probably make you a library with Lua ffi,

but that will definetly require you to disable Lua Sandboxing and prevent publishing to the Leadwerks Game Launcher.

 

 

//Edit:

here i added it to my small library.

https://cloud.software-sl.de/index.php/s/JLiv6hkd9koCLms

 

copy both files to your root directory of your game. (where your exe is)

 

and just add in your Main.lua or App.lua right at the top the line:

import("LEAddon.lua")

 

then you can use

addon.SetClipboardToText("This will end up in the clipboard")

 

or

local clipboardtext = addon.GetTextFromClipboard()

Edited by beo6
  • Upvote 1
Link to comment
Share on other sites

Hello Beo6!

that looks very nice!

I tried to include it into the main function after I copied the DLL and the lua file into the Folder where the EXEs are.

just when I add the

import("LEAddon.lua")

into the main file on the very top, it prompts an error:

 

attempt to call global 'require' - a nill value.

 

do I have to change some more?

I am quite new to lua

 

 

yours

Max

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...