* @brief Lua C closure for tableHandle(table, reg) -> handle; resolve once, off the hot path. */
| 2490 | * @brief Lua C closure for tableHandle(table, reg) -> handle; resolve once, off the hot path. |
| 2491 | */ |
| 2492 | static int luaTableHandle(lua_State* L) |
| 2493 | { |
| 2494 | auto* store = static_cast<DataModel::DataTableStore*>(lua_touserdata(L, lua_upvalueindex(1))); |
| 2495 | Q_ASSERT(store); |
| 2496 | |
| 2497 | const char* table = luaL_checkstring(L, 1); |
| 2498 | const char* reg = luaL_checkstring(L, 2); |
| 2499 | const qint64 handle = store->handleOf(QString::fromUtf8(table), QString::fromUtf8(reg)); |
| 2500 | |
| 2501 | lua_pushnumber(L, static_cast<lua_Number>(handle)); |
| 2502 | return 1; |
| 2503 | } |
| 2504 | |
| 2505 | /** |
| 2506 | * @brief Lua C closure for tableHandleMany(table, regs) -> handles; one handle per name, -1 if |
nothing calls this directly
no test coverage detected