VERSIÓ 1.0 RC4
- [NEW] sys.clipboard() per a llegir i escriure al portapapers.
This commit is contained in:
12
lua.cpp
12
lua.cpp
@@ -637,6 +637,17 @@ extern "C" {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cpp_sys_clipboard(lua_State *L) {
|
||||
if (lua_gettop(L) == 0) {
|
||||
lua_pushstring(L, SDL_GetClipboardText());
|
||||
return 1;
|
||||
} else {
|
||||
const char* value = luaL_checkstring(L, 1);
|
||||
SDL_SetClipboardText(value);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// win
|
||||
// ===============================================
|
||||
@@ -878,6 +889,7 @@ void push_lua_funcs() {
|
||||
lua_pushcfunction(L,cpp_sys_dir); lua_setfield(L, -2, "dir");
|
||||
lua_pushcfunction(L,cpp_sys_exit); lua_setfield(L, -2, "quit");
|
||||
lua_pushcfunction(L,cpp_sys_fps); lua_setfield(L, -2, "fps");
|
||||
lua_pushcfunction(L,cpp_sys_clipboard); lua_setfield(L, -2, "clipboard");
|
||||
|
||||
lua_pushinteger(L, 0); lua_setfield(L, -2, "UPDATE_ALWAYS");
|
||||
lua_pushinteger(L, 1); lua_setfield(L, -2, "UPDATE_WAIT");
|
||||
|
||||
Reference in New Issue
Block a user