Require cb_ prefix for plans

This commit is contained in:
2021-12-28 14:07:15 -05:00
parent 2e543984e6
commit 3b9dc2c495
4 changed files with 20 additions and 21 deletions

View File

@@ -58,6 +58,9 @@ LuaDefine(gui_menu_item, "action,label", "add a menu item to the current gui") {
LuaStack LS(L, laction, llabel);
std::string action = LS.ckstring(laction);
std::string label = LS.ckstring(llabel);
if (!util::has_prefix(action, "cb_")) {
luaL_error(L, "menuitem callbacks must start with cb_");
}
gui->menu_item(action, label);
return LS.result();
}