Fix help for +tangent/-tangent to be less obscure
[lsnes.git] / src / lua / bind.cpp
blob4a9f66fcfe7c1358a033684889a8615e93ceb83b
1 #include "core/instance.hpp"
2 #include "core/keymapper.hpp"
3 #include "core/command.hpp"
4 #include "lua/internal.hpp"
5 #include <stdexcept>
7 namespace
9 int kbd_bind(lua::state& L, lua::parameters& P)
11 std::string mod, mask, key, cmd;
13 P(mod, mask, key, cmd);
15 CORE().mapper->bind(mod, mask, key, cmd);
16 return 0;
19 int kbd_unbind(lua::state& L, lua::parameters& P)
21 std::string mod, mask, key;
23 P(mod, mask, key);
25 CORE().mapper->unbind(mod, mask, key);
26 return 0;
29 int kbd_alias(lua::state& L, lua::parameters& P)
31 auto& core = CORE();
32 std::string alias, cmds;
34 P(alias, cmds);
36 core.command->set_alias_for(alias, cmds);
37 (*core.abindmanager)();
38 return 0;
41 class lua_keyboard_dummy {};
42 lua::functions LUA_kbd_fns(lua_func_misc, "keyboard", {
43 {"bind", kbd_bind},
44 {"unbind", kbd_unbind},
45 {"alias", kbd_alias},
46 });