| 453 | } |
| 454 | |
| 455 | void ScriptBase::loadScriptMenus() |
| 456 | { |
| 457 | scriptMenuItems.clear(); |
| 458 | QVariant menus = get(scriptMenuTable); //[{title=xx, id=xx}...] |
| 459 | if(menus.type() == QVariant::List) |
| 460 | { |
| 461 | auto mlist = menus.toList(); |
| 462 | for(auto &m : mlist) |
| 463 | { |
| 464 | if(m.type() == QVariant::Map) |
| 465 | { |
| 466 | auto mObj = m.toMap(); |
| 467 | QString title = mObj.value("title").toString(), id =mObj.value("id").toString(); |
| 468 | if(title.isEmpty() || id.isEmpty()) continue; |
| 469 | scriptMenuItems.append({title, id}); |
| 470 | } |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | void ScriptBase::registerFuncs(const char *tname, const luaL_Reg *funcs) |
| 476 | { |