MCPcopy Create free account
hub / github.com/DFHack/dfhack / hotkey_removeKeybind

Function hotkey_removeKeybind

library/LuaApi.cpp:1908–1938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1906}
1907
1908static int hotkey_removeKeybind(lua_State *L) {
1909 auto hotkey_mgr = Core::getInstance().getHotkeyManager();
1910 if (!hotkey_mgr) {
1911 lua_pushboolean(L, false);
1912 return 1;
1913 }
1914
1915 bool res = false;
1916 switch (lua_gettop(L)) {
1917 case 1:
1918 luaL_checkstring(L, -1);
1919 res = hotkey_mgr->removeKeybind(lua_tostring(L, -1));
1920 break;
1921 case 2:
1922 luaL_checkstring(L, -2);
1923 res = hotkey_mgr->removeKeybind(lua_tostring(L, -2), lua_toboolean(L, -1));
1924 break;
1925 case 3:
1926 luaL_checkstring(L, -3);
1927 luaL_checkstring(L, -1);
1928 res = hotkey_mgr->removeKeybind(
1929 lua_tostring(L, -3),
1930 lua_toboolean(L, -2),
1931 lua_tostring(L, -1)
1932 );
1933 break;
1934 }
1935
1936 lua_pushboolean(L, res);
1937 return 1;
1938}
1939
1940void hotkey_pushBindArray(lua_State *L, const std::vector<Hotkey::KeyBinding>& binds) {
1941 lua_createtable(L, binds.size(), 0);

Callers

nothing calls this directly

Calls 4

lua_pushbooleanFunction · 0.85
lua_gettopFunction · 0.85
lua_tobooleanFunction · 0.85
removeKeybindMethod · 0.80

Tested by

no test coverage detected