From 9a3685348d1205cbffeb784df296d55216f512aa Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 1 Mar 2014 12:09:41 -0500 Subject: Use `assert(...)` as a shortcut for `if not ... then error() end`. --- modules/textadept/menu.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'modules/textadept/menu.lua') 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) -- cgit v1.2.3