diff --git a/jsmart.js b/jsmart.js index d5b59e3..f3adb9d 100644 --- a/jsmart.js +++ b/jsmart.js @@ -215,6 +215,23 @@ return code; } + /** + * Execute function when we have a object. + * + * @param object obj Object of the function to be called. + * @param array args Arguments to pass to a function. + * + * @return + * @throws Error If function obj does not exists. + */ + function executeByFuncObject(obj, args) { + try { + return obj.apply(this, args); + } catch (e) { + throw new Error(e.message + ' in \n' + code); + } + } + function assignVar(nm, val, data) { if (nm.match(/\[\]$/)) //ar[] = @@ -2089,17 +2106,24 @@ jSmart.prototype.registerPlugin( 'function', '__func', - function(params, data) - { - var paramNames = []; - var paramValues = {}; - for(var i=0; i