diff --git a/src/lua_script.c b/src/lua_script.c index 94578fb99089bbe9030f01934f0e04870d16dd35..92ae3d89a6fef8d7085cf1eb94457a32f8d44828 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -181,20 +181,10 @@ int LUA_PushGlobals(lua_State *L, const char *word) lua_pushboolean(L, stoppedclock); return 1; } else if (fastcmp(word,"defaulthubmap")) { - if (defaulthubmap == 0) { - lua_pushnil(L); - } - else { - lua_pushinteger(L, defaulthubmap); - } + lua_pushinteger(L, defaulthubmap); return 1; } else if (fastcmp(word, "currenthubmap")) { - if (currenthubmap == 0) { - lua_pushnil(L); - } - else { - lua_pushinteger(L, currenthubmap); - } + lua_pushinteger(L, currenthubmap); return 1; } else if (fastcmp(word, "hubmapenabled")) { lua_pushboolean(L, hubmapenabled); @@ -464,17 +454,12 @@ int LUA_PushGlobals(lua_State *L, const char *word) int LUA_CheckGlobals(lua_State *L, const char *word) { 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; + int mapnum = luaL_checkinteger(L, 2); + if (mapnum < 0 || 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")) hubmapenabled = luaL_checkboolean(L, 2);