1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-21 08:55:21 +01:00

Migrate existing keycode-based keybindings (#16049)

Co-authored-by: grorp <gregor.parzefall@posteo.de>
Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
y5nw
2025-05-14 22:15:15 +02:00
committed by GitHub
parent 600763dffc
commit 57c1ab905c
13 changed files with 140 additions and 13 deletions

View File

@@ -35,11 +35,10 @@ int ModApiMenuCommon::l_irrlicht_device_supports_touch(lua_State *L)
}
int ModApiMenuCommon::l_are_keycodes_equal(lua_State *L)
int ModApiMenuCommon::l_normalize_keycode(lua_State *L)
{
auto k1 = luaL_checkstring(L, 1);
auto k2 = luaL_checkstring(L, 2);
lua_pushboolean(L, KeyPress(k1) == KeyPress(k2));
auto keystr = luaL_checkstring(L, 1);
lua_pushstring(L, KeyPress(keystr).sym().c_str());
return 1;
}
@@ -49,7 +48,7 @@ void ModApiMenuCommon::Initialize(lua_State *L, int top)
API_FCT(gettext);
API_FCT(get_active_driver);
API_FCT(irrlicht_device_supports_touch);
API_FCT(are_keycodes_equal);
API_FCT(normalize_keycode);
}