1 #include "core/keymapper.hpp"
2 #include "core/command.hpp"
3 #include "lua/internal.hpp"
8 function_ptr_luafun
kbind(LS
, "keyboard.bind", [](lua_state
& L
, const std::string
& fname
) -> int {
9 std::string mod
= L
.get_string(1, fname
.c_str());
10 std::string mask
= L
.get_string(2, fname
.c_str());
11 std::string key
= L
.get_string(3, fname
.c_str());
12 std::string cmd
= L
.get_string(4, fname
.c_str());
14 lsnes_mapper
.bind(mod
, mask
, key
, cmd
);
15 } catch(std::exception
& e
) {
16 L
.pushstring(e
.what());
23 function_ptr_luafun
kunbind(LS
, "keyboard.unbind", [](lua_state
& L
, const std::string
& fname
) -> int {
24 std::string mod
= L
.get_string(1, fname
.c_str());
25 std::string mask
= L
.get_string(2, fname
.c_str());
26 std::string key
= L
.get_string(3, fname
.c_str());
28 lsnes_mapper
.unbind(mod
, mask
, key
);
29 } catch(std::exception
& e
) {
30 L
.pushstring(e
.what());
37 function_ptr_luafun
kalias(LS
, "keyboard.alias", [](lua_state
& L
, const std::string
& fname
) -> int {
38 std::string alias
= L
.get_string(1, fname
.c_str());
39 std::string cmds
= L
.get_string(2, fname
.c_str());
41 lsnes_cmd
.set_alias_for(alias
, cmds
);
42 } catch(std::exception
& e
) {
43 L
.pushstring(e
.what());