VERSIÓ 1.0 RC4

- [NEW] sys.clipboard() per a llegir i escriure al portapapers.
This commit is contained in:
2025-06-04 11:56:51 +02:00
parent 4bda9cbd39
commit 150cb9f4ff
2 changed files with 13 additions and 1 deletions

12
lua.cpp
View File

@@ -637,6 +637,17 @@ extern "C" {
return 1; 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 // 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_dir); lua_setfield(L, -2, "dir");
lua_pushcfunction(L,cpp_sys_exit); lua_setfield(L, -2, "quit"); 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_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, 0); lua_setfield(L, -2, "UPDATE_ALWAYS");
lua_pushinteger(L, 1); lua_setfield(L, -2, "UPDATE_WAIT"); lua_pushinteger(L, 1); lua_setfield(L, -2, "UPDATE_WAIT");

View File

@@ -1,3 +1,3 @@
#pragma once #pragma once
#define MINI_VERSION "1.0 RC3" #define MINI_VERSION "1.0 RC4"