From 150cb9f4ff3e0394b8f432f721c0e961a6fea2d4 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Wed, 4 Jun 2025 11:56:51 +0200 Subject: [PATCH] =?UTF-8?q?VERSI=C3=93=201.0=20RC4=20-=20[NEW]=20sys.clipb?= =?UTF-8?q?oard()=20per=20a=20llegir=20i=20escriure=20al=20portapapers.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua.cpp | 12 ++++++++++++ version.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lua.cpp b/lua.cpp index 5f5e206..8b1699b 100644 --- a/lua.cpp +++ b/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"); diff --git a/version.h b/version.h index a0ba3cd..5bf1ff4 100644 --- a/version.h +++ b/version.h @@ -1,3 +1,3 @@ #pragma once -#define MINI_VERSION "1.0 RC3" +#define MINI_VERSION "1.0 RC4"