- [NEW] sys.debug() returns true if we are on a debug version of mini. false otherwise.

This commit is contained in:
2026-03-04 10:12:53 +01:00
parent 681cbc2207
commit f12e46db1b
2 changed files with 14 additions and 0 deletions

10
lua.cpp
View File

@@ -788,6 +788,15 @@ extern "C" {
return 1;
}
static int cpp_sys_debug(lua_State *L) {
#ifdef DEBUG
lua_pushboolean(L, true);
#else
lua_pushboolean(L, false);
#endif
return 1;
}
static int cpp_sys_clipboard(lua_State *L) {
if (lua_gettop(L) == 0) {
lua_pushstring(L, SDL_GetClipboardText());
@@ -1081,6 +1090,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_debug); lua_setfield(L, -2, "debug");
lua_pushcfunction(L,cpp_sys_clipboard); lua_setfield(L, -2, "clipboard");
lua_pushinteger(L, 0); lua_setfield(L, -2, "UPDATE_ALWAYS");

View File

@@ -482,6 +482,10 @@ function sys.clipboard() end
---Sets the content of the clipboard
function sys.clipboard(value) end
---@return boolean
---Returns true if running on debug version of mini. False otherwise.
function sys.debug() end
---@class win
win = {}