From eafd8115b03fa61059be74fbb321286ec1e71251 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sun, 17 Jul 2016 23:36:36 -0400 Subject: [PATCH] add onlyEnabled option to tpt.num_menus (probably useless) --- src/lua/LegacyLuaAPI.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lua/LegacyLuaAPI.cpp b/src/lua/LegacyLuaAPI.cpp index 856a3d6d3..48221d070 100644 --- a/src/lua/LegacyLuaAPI.cpp +++ b/src/lua/LegacyLuaAPI.cpp @@ -1820,7 +1820,14 @@ int luatpt_menu_enabled(lua_State* l) int luatpt_num_menus(lua_State* l) { - lua_pushinteger(l, luacon_controller->GetNumMenus(true)); + int acount = lua_gettop(l); + bool onlyEnabled = true; + if (acount > 0) + { + luaL_checktype(l, 1, LUA_TBOOLEAN); + onlyEnabled = lua_toboolean(l, 1); + } + lua_pushinteger(l, luacon_controller->GetNumMenus(onlyEnabled)); return 1; }