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

Function hotkey_pushBindArray

library/LuaApi.cpp:1940–1956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1938}
1939
1940void 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
1958static int hotkey_listActiveKeybinds(lua_State *L) {
1959 auto hotkey_mgr = Core::getInstance().getHotkeyManager();

Callers 2

hotkey_listAllKeybindsFunction · 0.85

Calls 7

lua_createtableFunction · 0.85
lua_pushlstringFunction · 0.85
lua_settableFunction · 0.85
lua_rawsetiFunction · 0.85
sizeMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected