|
GameApi 28
Library used by GameApi Builder tool
|
Represents a function object in ChaiScript. More...
#include <chaiscript_prelude_docs.hpp>
Public Member Functions | |
| string | get_annotation () const |
| Returns the annotation description of the function. | |
| int | get_arity () const |
| Returns the arity of the function, -1 if the function takes a variable number of parameters. | |
| Vector | get_contained_functions () const |
| Returns a vector of the contained functions. | |
| Function | get_guard () const |
| Returns a function guard as function. | |
| Vector | get_param_types () const |
| Returns a vector of Type_Info objects that represent the param types for this function. The first value in the list is the return type. | |
| bool | has_guard () const |
| Returns true if the function has a guard to it. Always returns false for a conglomerate function. | |
| Object | call (Vector t_params) const |
| Calls the function with the given set of parameters and returns the value;. | |
Represents a function object in ChaiScript.
A function object may be one function, such as:
Or it may represent multiple functions
Guarded function example
Examples in the function definitions below will reference these examples
Calls the function with the given set of parameters and returns the value;.
Example:
| string ChaiScript_Language::Function::get_annotation | ( | ) | const |
Returns the annotation description of the function.
| int ChaiScript_Language::Function::get_arity | ( | ) | const |
| Vector ChaiScript_Language::Function::get_contained_functions | ( | ) | const |
| Function ChaiScript_Language::Function::get_guard | ( | ) | const |
Returns a function guard as function.
Example:
| Vector ChaiScript_Language::Function::get_param_types | ( | ) | const |
Returns a vector of Type_Info objects that represent the param types for this function. The first value in the list is the return type.
If this function is a conglomerate of several functions (get_contained_values().size() > 0) then the function returns as many Type_Info objects as it can. If the functions contained all have the same arity, then it represents the arity. If they have different arities, it returns only one value - the return type.
For each parameter that is the same type, the type is returned. If the types are different then a Type_Info for Object is returned.
Example:
| bool ChaiScript_Language::Function::has_guard | ( | ) | const |
Returns true if the function has a guard to it. Always returns false for a conglomerate function.