| 465 | } |
| 466 | |
| 467 | void LuaScriptInterface::RemoveEventHandler(int eventType, int stackIndex) |
| 468 | { |
| 469 | auto &list = gameControllerEventHandlers[eventType]; |
| 470 | auto it = list.begin(); |
| 471 | auto end = list.end(); |
| 472 | lua_pushvalue(L, stackIndex); |
| 473 | while (it != end) |
| 474 | { |
| 475 | it->Push(L); |
| 476 | auto equal = lua_equal(L, -1, -2); |
| 477 | lua_pop(L, 1); |
| 478 | if (equal) |
| 479 | { |
| 480 | for (auto currentEventHandlerIt : currentEventHandlerIts) |
| 481 | { |
| 482 | if (*currentEventHandlerIt == it) |
| 483 | { |
| 484 | ++*currentEventHandlerIt; |
| 485 | } |
| 486 | } |
| 487 | list.erase(it); |
| 488 | break; |
| 489 | } |
| 490 | ++it; |
| 491 | } |
| 492 | lua_pop(L, 1); |
| 493 | } |
| 494 | |
| 495 | template<size_t Index> |
| 496 | std::enable_if_t<Index != std::variant_size_v<GameControllerEvent>, bool> HaveSimGraphicsEventHandlersHelper(const auto &gameControllerEventHandlers) |
no test coverage detected