From f12e46db1b8a320ccfe9ae6564dbb37b5bab5502 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Wed, 4 Mar 2026 10:12:53 +0100 Subject: [PATCH] - [NEW] sys.debug() returns true if we are on a debug version of mini. false otherwise. --- lua.cpp | 10 ++++++++++ vscode/library.lua | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/lua.cpp b/lua.cpp index 3d66bcc..b9e5fd5 100644 --- a/lua.cpp +++ b/lua.cpp @@ -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"); diff --git a/vscode/library.lua b/vscode/library.lua index 820b77b..cd8a766 100644 --- a/vscode/library.lua +++ b/vscode/library.lua @@ -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 = {}