defs

Syntax

defs([X])

Details

  • If X is not specified, return all functions in the system as a table.
  • If X is specified, return all functions with names consistent with the pattern of X.

The returned table contains the following fields:

Field Description
name Function name
isCommand Whether the function is a command
userDefined Whether the function is user-defined
isView Whether the function is a function view
minParamCount Minimum number of arguments
maxParamCount Maximum number of arguments
syntax Function syntax

Parameters

X is a string. It supports wildcard symbols "%" and "?". "%" means 0, 1 or multiple characters and "?" means 1 character.

Returns

A table.

Examples

defs();
name isCommand userDefined isView minParamCount maxParamCount syntax
!=_2 0 0 0 2 2 (X, Y)
!_1 0 0 0 1 1 (X)
$_2 0 0 0 2 2 (obj, type)
%_2 0 0 0 2 2 (X, Y)
&&_2 0 0 0 2 2 (X, Y)
&_2 0 0 0 2 2 (X, Y)
**_2 0 0 0 2 2 (X, Y)
*_2 0 0 0 2 2 (X, Y)
+_2 0 0 0 2 2 (X, Y)
-_1 0 0 0 1 1 (X)
...
typestr defs();
// output: IN-MEMORY TABLE;

select * from defs() where name like "bit%";
name isCommand userDefined isView minParamCount maxParamCount syntax
bitAnd 0 0 0 2 2 (X, Y)
bitNot 0 0 0 1 1 (X)
bitOr 0 0 0 2 2 (X, Y)
bitXor 0 0 0 2 2 (X, Y)
defs("bit%");
name isCommand userDefined isView minParamCount maxParamCount syntax
bitAnd 0 0 0 2 2 (X, Y)
bitNot 0 0 0 1 1 (X)
bitOr 0 0 0 2 2 (X, Y)
bitXor 0 0 0 2 2 (X, Y)
defs("%sin");
name isCommand userDefined isView minParamCount maxParamCount syntax
asin 0 0 0 1 1 (X)
sin 0 0 0 1 1 (X)
defs("?sin");
name isCommand userDefined isView minParamCount maxParamCount syntax
asin 0 0 0 1 1 (X)
// define func1
def func1(){
    return 1
}

// define function func1 to be a function view
// addFunctionView can only be executed by administrators or users with VIEW_OWNER permission
addFunctionView(func1)
select * from defs() where name = "func1"
name isCommand userDefined isView minParamCount maxParamCount syntax
func1 0 0 1 0 0 ()
func1 0 0 1 0 0 ()
Note:
After adding a function as a function view via addFunctionView, defs() will return two records of a function view.