| 1938 | } |
| 1939 | |
| 1940 | void hotkey_pushBindArray(lua_State *L, const std::vector<Hotkey::KeyBinding>& binds) { |
| 1941 | lua_createtable(L, binds.size(), 0); |
| 1942 | int i = 1; |
| 1943 | for (const auto& bind : binds) { |
| 1944 | lua_createtable(L, 0, 2); |
| 1945 | |
| 1946 | lua_pushlstring(L, "spec", 4); |
| 1947 | auto spec_str = bind.spec.toString(true); |
| 1948 | lua_pushlstring(L, spec_str.data(), spec_str.size()); |
| 1949 | lua_settable(L, -3); |
| 1950 | |
| 1951 | lua_pushlstring(L, "command", 7); |
| 1952 | lua_pushlstring(L, bind.cmdline.data(), bind.cmdline.size()); |
| 1953 | lua_settable(L, -3); |
| 1954 | lua_rawseti(L, -2, i++); |
| 1955 | } |
| 1956 | } |
| 1957 | |
| 1958 | static int hotkey_listActiveKeybinds(lua_State *L) { |
| 1959 | auto hotkey_mgr = Core::getInstance().getHotkeyManager(); |
no test coverage detected