diff --git a/src/lua_script.c b/src/lua_script.c index 686555a16d6b09b98d839cefec0ac0fc876181ae..15db1b0a67b7881237b71983d6059c860f9597f8 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -180,6 +180,25 @@ int LUA_PushGlobals(lua_State *L, const char *word) } else if (fastcmp(word,"stoppedclock")) { lua_pushboolean(L, stoppedclock); return 1; + } else if (fastcmp(word,"defaulthubmap")) { + if (defaulthubmap == 0) { + lua_pushnil(L); + } + else { + lua_pushinteger(L, defaulthubmap); + } + return 1; + } else if (fastcmp(word, "currenthubmap")) { + if (currenthubmap == 0) { + lua_pushnil(L); + } + else { + lua_pushinteger(L, currenthubmap); + } + return 1; + } else if (fastcmp(word, "hubmapenabled")) { + lua_pushboolean(L, !hubmapdisabled); + return 1; } else if (fastcmp(word,"netgame")) { lua_pushboolean(L, netgame); return 1; @@ -444,7 +463,22 @@ int LUA_PushGlobals(lua_State *L, const char *word) // See the above. int LUA_CheckGlobals(lua_State *L, const char *word) { - if (fastcmp(word, "redscore")) + if (fastcmp(word, "currenthubmap")) { + if (lua_isnoneornil(L, 2)) { + currenthubmap = 0; + } + else { + int mapnum = luaL_checkinteger(L, 2); + if (mapnum < 1 || mapnum > NUMMAPS) { + luaL_error(L, "map number %d out of range (1 - %d)", mapnum, NUMMAPS); + return 1; + } + currenthubmap = (INT16)mapnum; + } + } + else if (fastcmp(word, "hubmapenabled")) + hubmapdisabled = !luaL_checkboolean(L, 2); + else if (fastcmp(word, "redscore")) redscore = (UINT32)luaL_checkinteger(L, 2); else if (fastcmp(word, "bluescore")) bluescore = (UINT32)luaL_checkinteger(L, 2);