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"