core.get_bindings moved to input.get_bindings
This commit is contained in:
@@ -16,7 +16,7 @@ function on_open()
|
|||||||
refresh_sensitivity()
|
refresh_sensitivity()
|
||||||
|
|
||||||
local panel = document.bindings_panel
|
local panel = document.bindings_panel
|
||||||
local bindings = core.get_bindings()
|
local bindings = input.get_bindings()
|
||||||
table.sort(bindings, function(a, b) return a > b end)
|
table.sort(bindings, function(a, b) return a > b end)
|
||||||
for i,name in ipairs(bindings) do
|
for i,name in ipairs(bindings) do
|
||||||
panel:add(gui.template("binding", {
|
panel:add(gui.template("binding", {
|
||||||
|
|||||||
@@ -100,19 +100,6 @@ static int l_reconfig_packs(lua_State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int l_get_setting(lua_State* L) {
|
static int l_get_setting(lua_State* L) {
|
||||||
auto name = lua_tostring(L, 1);
|
auto name = lua_tostring(L, 1);
|
||||||
const auto value = scripting::engine->getSettingsHandler().getValue(name);
|
const auto value = scripting::engine->getSettingsHandler().getValue(name);
|
||||||
@@ -186,7 +173,6 @@ const luaL_Reg corelib [] = {
|
|||||||
{"close_world", lua_wrap_errors<l_close_world>},
|
{"close_world", lua_wrap_errors<l_close_world>},
|
||||||
{"delete_world", lua_wrap_errors<l_delete_world>},
|
{"delete_world", lua_wrap_errors<l_delete_world>},
|
||||||
{"reconfig_packs", lua_wrap_errors<l_reconfig_packs>},
|
{"reconfig_packs", lua_wrap_errors<l_reconfig_packs>},
|
||||||
{"get_bindings", lua_wrap_errors<l_get_bindings>},
|
|
||||||
{"get_setting", lua_wrap_errors<l_get_setting>},
|
{"get_setting", lua_wrap_errors<l_get_setting>},
|
||||||
{"set_setting", lua_wrap_errors<l_set_setting>},
|
{"set_setting", lua_wrap_errors<l_set_setting>},
|
||||||
{"str_setting", lua_wrap_errors<l_str_setting>},
|
{"str_setting", lua_wrap_errors<l_str_setting>},
|
||||||
|
|||||||
@@ -55,11 +55,25 @@ static int l_get_mouse_pos(lua_State* L) {
|
|||||||
return lua::pushvec2_arr(L, Events::cursor);
|
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 [] = {
|
const luaL_Reg inputlib [] = {
|
||||||
{"keycode", lua_wrap_errors<l_keycode>},
|
{"keycode", lua_wrap_errors<l_keycode>},
|
||||||
{"mousecode", lua_wrap_errors<l_mousecode>},
|
{"mousecode", lua_wrap_errors<l_mousecode>},
|
||||||
{"add_callback", lua_wrap_errors<l_add_callback>},
|
{"add_callback", lua_wrap_errors<l_add_callback>},
|
||||||
{"get_mouse_pos", lua_wrap_errors<l_get_mouse_pos>},
|
{"get_mouse_pos", lua_wrap_errors<l_get_mouse_pos>},
|
||||||
|
{"get_bindings", lua_wrap_errors<l_get_bindings>},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user