Lua API: Exclude color ranges with numeric names from the __dir output

In general they are not supposed to have numeric names, but several with numeric names exist for backwards compatibility.
This commit is contained in:
Celtic Minstrel 2024-09-12 00:04:00 -04:00 committed by Celtic Minstrel
parent d7eba7b950
commit 5bbca1a1c9

View File

@ -141,6 +141,10 @@ static int impl_colors_table_dir(lua_State* L)
{
std::vector<std::string> all_colours;
for(const auto& [key, value] : game_config::team_rgb_range) {
if(std::all_of(key.begin(), key.end(), [](char c) {return isdigit(c);})) {
// These colors are deprecated, don't show them
continue;
}
all_colours.push_back(key);
}
lua_push(L, all_colours);