core.get_bindings moved to input.get_bindings

This commit is contained in:
MihailRis
2024-06-03 18:06:09 +03:00
parent 06e9d60bae
commit db074b13be
3 changed files with 15 additions and 15 deletions
+14
View File
@@ -55,11 +55,25 @@ static int l_get_mouse_pos(lua_State* L) {
return lua::pushvec2_arr(L, Events::cursor);
}
static int l_get_bindings(lua_State* L) {
auto& bindings = Events::bindings;
lua_createtable(L, bindings.size(), 0);
int i = 0;
for (auto& entry : bindings) {
lua_pushstring(L, entry.first.c_str());
lua_rawseti(L, -2, i + 1);
i++;
}
return 1;
}
const luaL_Reg inputlib [] = {
{"keycode", lua_wrap_errors<l_keycode>},
{"mousecode", lua_wrap_errors<l_mousecode>},
{"add_callback", lua_wrap_errors<l_add_callback>},
{"get_mouse_pos", lua_wrap_errors<l_get_mouse_pos>},
{"get_bindings", lua_wrap_errors<l_get_bindings>},
{NULL, NULL}
};