boxmein: Added clipboard support to Lua
This commit is contained in:
parent
cf503a29f4
commit
5b886fc51e
@ -9,6 +9,7 @@
|
||||
#include "Format.h"
|
||||
#include "LuaScriptInterface.h"
|
||||
#include "LuaScriptHelper.h"
|
||||
#include "PowderToy.h"
|
||||
|
||||
#include "gui/dialogues/ErrorMessage.h"
|
||||
#include "gui/dialogues/InformationMessage.h"
|
||||
@ -2053,4 +2054,18 @@ int luatpt_screenshot(lua_State* l)
|
||||
lua_pushstring(l, filename.str().c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int luatpt_getclip (lua_State* l)
|
||||
{
|
||||
lua_pushstring(l, ClipboardPull());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int luatpt_setclip (lua_State* l)
|
||||
{
|
||||
luaL_checktype(l, 1, LUA_TSTRING);
|
||||
ClipboardPush((char*) std::string(luaL_optstring(l, 1, "")).c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -129,5 +129,8 @@ int luatpt_getscript(lua_State* l);
|
||||
int luatpt_setwindowsize(lua_State* l);
|
||||
|
||||
int luatpt_screenshot(lua_State* l);
|
||||
int luatpt_getclip(lua_State* l);
|
||||
int luatpt_setclip(lua_State* l);
|
||||
|
||||
|
||||
#endif /* LUASCRIPTHELPER_H_ */
|
||||
|
@ -188,6 +188,8 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
|
||||
{"element",&luatpt_getelement},
|
||||
{"element_func",&luatpt_element_func},
|
||||
{"graphics_func",&luatpt_graphics_func},
|
||||
{"get_clipboard", &luatpt_getclip},
|
||||
{"set_clipboard", &luatpt_setclip},
|
||||
{NULL,NULL}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user