feat: add CalendarGetDate and calendar stubs
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run

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.
This commit is contained in:
Kelsi 2026-03-23 00:33:09 -07:00
parent df610ff472
commit f9464dbacd

View file

@ -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