More refactoring and cleanup

This commit is contained in:
2021-11-16 13:14:59 -05:00
parent 077b2fc23b
commit 51a95cc964
8 changed files with 49 additions and 36 deletions

View File

@@ -36,12 +36,22 @@ bool Gui::has_action(const std::string &action) const {
}
std::string Gui::get_action(int index) {
if ((index < 0) || (index >= elts_.size())) {
if ((index < 0) || (index >= int(elts_.size()))) {
return "";
}
return elts_[index].action();
}
std::string Gui::menu_debug_string() const {
std::ostringstream oss;
int index = 0;
for (const GuiElt &elt : elts()) {
oss << index << " " << elt.label() << std::endl;
index += 1;
}
return oss.str();
}
LuaDefine(gui_menu_item, "c") {
Gui *gui = Gui::fetch_global_pointer(L);
LuaArg laction, llabel;