Merge pull request #315 from Sergwest585/main

small ide stuff + search controls
This commit is contained in:
MihailRis 2024-10-20 06:03:23 +03:00 • committed by GitHub
commit 5ca83a572b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 71 additions and 2 deletions

View file

@ -64,6 +64,20 @@ static int l_get_bindings(lua::State* L) {
return 1;
}
static int l_get_binding_text(lua::State* L) {
auto bindname = lua::require_string(L, 1);
auto index = Events::bindings.find(bindname);
if (index == Events::bindings.end()) {
throw std::runtime_error("unknown binding " + util::quote(bindname));
lua::pushstring(L, "");
} else {
lua::pushstring(L, index->second.text());
}
return 1;
}
static int l_is_active(lua::State* L) {
auto bindname = lua::require_string(L, 1);
const auto& bind = Events::bindings.find(bindname);
@ -101,6 +115,7 @@ const luaL_Reg inputlib[] = {
{"add_callback", lua::wrap<l_add_callback>},
{"get_mouse_pos", lua::wrap<l_get_mouse_pos>},
{"get_bindings", lua::wrap<l_get_bindings>},
{"get_binding_text", lua::wrap<l_get_binding_text>},
{"is_active", lua::wrap<l_is_active>},
{"is_pressed", lua::wrap<l_is_pressed>},
{NULL, NULL}};