From bc4da963e5ebc651d1d7839a4da39ba59dfa4ea0 Mon Sep 17 00:00:00 2001 From: aunsane Date: Sat, 2 Sep 2017 22:08:32 +0300 Subject: MirLua: small refactoring --- plugins/MirLua/src/m_hotkeys.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'plugins/MirLua/src/m_hotkeys.cpp') diff --git a/plugins/MirLua/src/m_hotkeys.cpp b/plugins/MirLua/src/m_hotkeys.cpp index 63358fd31c..2b2aed8c18 100644 --- a/plugins/MirLua/src/m_hotkeys.cpp +++ b/plugins/MirLua/src/m_hotkeys.cpp @@ -36,11 +36,7 @@ void MakeHotkey(lua_State *L, HOTKEYDESC &hk) static int hotkeys_Register(lua_State *L) { - if (lua_type(L, 1) != LUA_TTABLE) - { - lua_pushlightuserdata(L, 0); - return 1; - } + luaL_checktype(L, 1, LUA_TTABLE); HOTKEYDESC hk; MakeHotkey(L, hk); @@ -56,7 +52,9 @@ static int hotkeys_Register(lua_State *L) static int hotkeys_Unregister(lua_State *L) { const char *name = luaL_checkstring(L, 1); + Hotkey_Unregister(name); + return 0; } -- cgit v1.2.3