MaxAigner Posted August 31, 2015 Share Posted August 31, 2015 Dear People of this Forum, I want to transfer a string to the windows - clipboard on the Lua Leadwerks version. how can I do so? PS: how can I use Windows API in general with Lua? thanks for your Help! yours Max Aigner Quote Link to comment Share on other sites More sharing options...
Rick Posted August 31, 2015 Share Posted August 31, 2015 PS: how can I use Windows API in general with Lua? You don't. It has to be exposed somehow to Lua. Either you do that manually or see if someone else has already done that in the Lua community (as it's not really LE specific). 1 Quote Link to comment Share on other sites More sharing options...
beo6 Posted August 31, 2015 Share Posted August 31, 2015 (edited) 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 August 31, 2015 by beo6 1 Quote Link to comment Share on other sites More sharing options...
MaxAigner Posted September 1, 2015 Author Share Posted September 1, 2015 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 Quote Link to comment Share on other sites More sharing options...
macklebee Posted September 1, 2015 Share Posted September 1, 2015 Like beo6 mentions in his post, you have to disable lua sandboxing to be able to use it. Click on TOOLS-->Options... 2 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted March 4, 2018 Share Posted March 4, 2018 Did anyone happen to save off @beo6 library he linked to above? It doesn't work anymore and I'm trying to get clipboard functionality on windows to work. Quote Link to comment Share on other sites More sharing options...
Rick Posted March 4, 2018 Share Posted March 4, 2018 Nvm, found a good answer here that works: https://stackoverflow.com/questions/24751648/how-to-save-to-and-from-clipboard-in-lua-windows I load it with: -- load the clipboard library assert(package.loadlib("clipboard.dll", "luaopen_clipboard"))() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.