From f9464dbacdedf3f052a51b200a6b76ce633756c7 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 23 Mar 2026 00:33:09 -0700 Subject: [PATCH] feat: add CalendarGetDate and calendar stubs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CalendarGetDate() returns real weekday, month, day, year from the system clock. Used by calendar addons and date-aware UI elements. CalendarGetNumPendingInvites() and CalendarGetNumDayEvents() return 0 as stubs — prevents nil errors in addons that check calendar state. --- src/addons/lua_engine.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index 9f2e4468..db94d109 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -5062,6 +5062,23 @@ void LuaEngine::registerCoreAPI() { lua_pushboolean(L, 1); // isCastable return 4; }}, + // --- Calendar --- + {"CalendarGetDate", [](lua_State* L) -> int { + // CalendarGetDate() → weekday, month, day, year + time_t now = time(nullptr); + struct tm* t = localtime(&now); + lua_pushnumber(L, t->tm_wday + 1); // weekday (1=Sun) + lua_pushnumber(L, t->tm_mon + 1); // month (1-12) + lua_pushnumber(L, t->tm_mday); // day + lua_pushnumber(L, t->tm_year + 1900); // year + return 4; + }}, + {"CalendarGetNumPendingInvites", [](lua_State* L) -> int { + lua_pushnumber(L, 0); return 1; + }}, + {"CalendarGetNumDayEvents", [](lua_State* L) -> int { + lua_pushnumber(L, 0); return 1; + }}, // --- Instance --- {"GetDifficultyInfo", [](lua_State* L) -> int { // GetDifficultyInfo(id) → name, groupType, isHeroic, maxPlayers