diff options
author | 2014-03-01 12:09:41 -0500 | |
---|---|---|
committer | 2014-03-01 12:09:41 -0500 | |
commit | 9a3685348d1205cbffeb784df296d55216f512aa (patch) | |
tree | 7be097113b7aa54dbbc99b651bb2d355dcbcec40 /modules/textadept/menu.lua | |
parent | b3be88aed1e8196c5b0490a8e22c5839fdd12e18 (diff) | |
download | textadept-9a3685348d1205cbffeb784df296d55216f512aa.tar.gz textadept-9a3685348d1205cbffeb784df296d55216f512aa.zip |
Use `assert(...)` as a shortcut for `if not ... then error() end`.
Diffstat (limited to 'modules/textadept/menu.lua')
-rw-r--r-- | modules/textadept/menu.lua | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index ea4b9db1..3a0348ab 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -379,9 +379,8 @@ end events.connect(events.MENU_CLICKED, function(menu_id) local actions = menu_id < 1000 and menu_actions or contextmenu_actions local action = actions[menu_id < 1000 and menu_id or menu_id - 1000] - if type(action) ~= 'function' and type(action) ~= 'table' then - error(_L['Unknown command:']..' '..tostring(action)) - end + assert(type(action) == 'function' or type(action) == 'table', + _L['Unknown command:']..' '..tostring(action)) keys.run_command(action, type(action)) end) |