From 918ef23773b310dca3b3d21969a63760ad72887b Mon Sep 17 00:00:00 2001 From: walterhiggins Date: Sat, 14 Jun 2014 15:38:41 +0100 Subject: [PATCH] Support named function in lieu of command name as first argument --- src/main/js/lib/command.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/js/lib/command.js b/src/main/js/lib/command.js index 6f2ae12..2ba6a4d 100644 --- a/src/main/js/lib/command.js +++ b/src/main/js/lib/command.js @@ -42,6 +42,14 @@ var executeCmd = function( args, player ) { define a new JSP command. */ var defineCmd = function( name, func, options, intercepts ) { + + if ( typeof name == 'function'){ + intercepts = options; + options = func; + func = name; + name = func.name; + } + if ( typeof options == 'undefined' ) { options = []; }