* @brief Lua C closure for tableHandleMany(table, regs) -> handles; one handle per name, -1 if * unknown. */
| 2507 | * unknown. |
| 2508 | */ |
| 2509 | static int luaTableHandleMany(lua_State* L) |
| 2510 | { |
| 2511 | auto* store = static_cast<DataModel::DataTableStore*>(lua_touserdata(L, lua_upvalueindex(1))); |
| 2512 | Q_ASSERT(store); |
| 2513 | |
| 2514 | const QString table = QString::fromUtf8(luaL_checkstring(L, 1)); |
| 2515 | luaL_checktype(L, 2, LUA_TTABLE); |
| 2516 | |
| 2517 | const lua_Integer n = luaL_len(L, 2); |
| 2518 | lua_newtable(L); |
| 2519 | for (lua_Integer i = 1; i <= n; ++i) { |
| 2520 | lua_geti(L, 2, i); |
| 2521 | const qint64 handle = store->handleOf(table, QString::fromUtf8(luaL_checkstring(L, -1))); |
| 2522 | lua_pop(L, 1); |
| 2523 | lua_pushnumber(L, static_cast<lua_Number>(handle)); |
| 2524 | lua_seti(L, -2, i); |
| 2525 | } |
| 2526 | |
| 2527 | return 1; |
| 2528 | } |
| 2529 | |
| 2530 | /** |
| 2531 | * @brief Lua C closure for tableGetH(handle); nil for a stale or invalid handle. |
nothing calls this directly
no test coverage detected