- 
                Notifications
    
You must be signed in to change notification settings  - Fork 19
 
Expression natives
native Expression:expr_acquire(Expression:expr);Increases the reference count stored inside the expression object.
native Expression:expr_release(Expression:expr);Decreases the reference count stored inside the expression object.
native expr_delete(Expression:expr);Instantly deletes an expression, making it unreachable from code. The actual object may not be deleted however, if other expressions reference it.
native bool:expr_valid(Expression:expr);Returns true if the argument is a valid reference to an expression object.
native expr_type(Expression:expr);Returns a number that uniquely identifies the type of the expression. The result is not guaranteed to be consistent across platforms, versions, or unique instances of the plugin.
native expr_type_str(Expression:expr, type[], size=sizeof(type));
native String:expr_type_str_s(Expression:expr);Returns a string representation of the type of the expression. The result is not guaranteed to be consistent across platforms, versions, or unique instances of the plugin.
native Expression:expr_parse(const string[]);
native Expression:expr_parse_s(ConstString:string);Constructs a new expression from its string representation. More information about the parser here.
native Expression:expr_empty();Creates an empty expression with no value.
native Expression:expr_weak(Expression:expr);Creates a new weakly linked expression, delegating all operations to expr. expr is not protected from deletion.
native Expression:expr_weak_set(Expression:weak, Expression:target);Sets the target of a weakly linked expression. This is a potentially dangerous operation, since doing so may change existing expressions or introduce unbounded recursion.
native Expression:expr_const(AnyTag:value, TagTag:tag_id=tagof(value));
native Expression:expr_const_arr(const AnyTag:value[], size=sizeof(value), TagTag:tag_id=tagof(value));
native Expression:expr_const_str(const value[]);
native Expression:expr_const_var(VariantTag:value);Creates a new constant expression whose value never changes.
native Expression:expr_arr(Expression:...);Creates a new array construction expression from its arguments. All arguments must have the same tag in order to create an array.
native Expression:expr_arg(index);Creates a new argument expression for an external argument at index. Arguments are provided to the expression by its caller, depending on the context.
native Expression:expr_arg_pack(begin, end=-1);Creates a new argument pack expression for a range of arguments starting at begin and ending at end (inclusive). If end is unspecified, the result corresponds to the whole range of arguments starting at begin. If end is specified, all arguments must be provided. In the other case, the argument at begin must be provided or begin must be equal to the total number of provided arguments (e.g. if 3 arguments are provided, begin can be 3 but not 4 or more).
native Expression:expr_bind(Expression:expr, Expression:...);Creates a bind expression which, when executed, provides its initial arguments to the inner expression.
native Expression:expr_nested(Expression:expr);Creates a nested expression which limits the possible operations on expr to only obtaining its value.
native Expression:expr_env();Creates a new expression which, when indexed, obtains a value in the expression environment.
native Expression:expr_set_env(Expression:expr, Map:env=INVALID_MAP, bool:env_readonly=false);Creates a new expression which changes the environment used for operations in expr. The lifetime of env can be prolonged by the expression. Setting env_readonly to true makes the environment (new or original) non-modifiable.
native Expression:expr_comma(Expression:left, Expression:right);Joins two expressions together via the comma operator. When executed, both expressions are executed in order, and their results are returned (or the last result is returned if a single value is expected).
native Expression:expr_assign(Expression:left, Expression:right);Creates a new assignment expression.
native Expression:expr_try(Expression:main, Expression:fallback);Creates a new try/catch expression. On execution, it invokes main, but results to fallback if the expression produces an error.
native Expression:expr_symbol(Symbol:symbol);Creates a new expression from a given debug symbol. The symbol can be both a variable or a function, but in case of a local variable, it must be located in the current stack frame.
native Expression:expr_native(const function[], bool:local=true);Creates a new expression corresponding to a native function. If local is true, the expression is bound to the current AMX instance (so executing it from other scripts will still not call the native there).
native Expression:expr_public(const function[]);Creates a new expression corresponding to a public function in the current script.
native Expression:expr_call(Expression:func, Expression:...);Creates a new call expression from a function expression and its arguments. The result of expr_symbol and expr_native can be used as the function expression. A valid Expression: value can also be called.
native Expression:expr_index(Expression:arr, Expression:...);Creates a new indexing expression from an array expression and a list of indices.
native Expression:expr_quote(Expression:expr);Creates a new quote expression which, upon execution, wraps its operand in an Expression: value.
native Expression:expr_dequote(Expression:expr);Creates a new dequote expression which, upon execution, accepts an Expression: value and delegates all own operations to it.
native Expression:expr_value(Expression:var);Creates a new expression that obtains the actual value from a Variant: value.
native Expression:expr_variant(Expression:value);Creates a new expression that produces a new Variant: instance from a value.
native Expression:expr_add(Expression:left, Expression:right);
native Expression:expr_sub(Expression:left, Expression:right);
native Expression:expr_mul(Expression:left, Expression:right);
native Expression:expr_div(Expression:left, Expression:right);
native Expression:expr_mod(Expression:left, Expression:right);
native Expression:expr_bit_and(Expression:left, Expression:right);
native Expression:expr_bit_or(Expression:left, Expression:right);
native Expression:expr_bit_xor(Expression:left, Expression:right);
native Expression:expr_rs(Expression:left, Expression:right);
native Expression:expr_ls(Expression:left, Expression:right);
native Expression:expr_neg(Expression:expr);
native Expression:expr_inc(Expression:expr);
native Expression:expr_dec(Expression:expr);
native Expression:expr_bit_not(Expression:expr);
native Expression:expr_eq(Expression:left, Expression:right);
native Expression:expr_neq(Expression:left, Expression:right);
native Expression:expr_lt(Expression:left, Expression:right);
native Expression:expr_gt(Expression:left, Expression:right);
native Expression:expr_lte(Expression:left, Expression:right);
native Expression:expr_gte(Expression:left, Expression:right);
native Expression:expr_not(Expression:expr);
native Expression:expr_and(Expression:left, Expression:right);
native Expression:expr_or(Expression:left, Expression:right);Creates a new unary or binary operation expression. The behaviour is analogous to variant operations and Pawn.
native Expression:expr_cond(Expression:cond, Expression:on_true, Expression:on_false);Creates a new conditional expression. When executed, cond is invoked and its result determines which expression is used for providing the value of the expression.
``pawn native Expression:expr_select(Expression:func, Expression:list);
Creates a new select expression which executes `list` and processes all values returned with `func` (where `$arg0` is the current result).
#### `expr_where`
```pawn
native Expression:expr_where(Expression:cond, Expression:list);
Creates a new where expression which executes list and removes all its results that do not match cond (where $arg0 is the current result).
native Expression:expr_cast(Expression:expr, TagTag:tag_id);Creates a new cast expression. The value of the result will be identical to expr, but with a new tag.
native Expression:expr_tagof(Expression:expr);Creates a new tagof expression. The result of the expression is a single cell corresponding to the tag id of the operand. The inner expression may not be called if the tag can be determined from its type.
native Expression:expr_sizeof(Expression:expr, Expression:...);Creates a new sizeof expression from a list of indices. The result of the expression is a single cell corresponding to the size of the operand. The inner expression may not be called if the size can be determined from its type.
native Expression:expr_rankof(Expression:expr);Creates a new rankof expression. The result of the expression is a single cell corresponding to the rank (number of dimensions) of the operand. The inner expression may not be called if the rank can be determined from its type.
native Expression:expr_addressof(Expression:expr);Creates a new addressof expression. When executed, the value of expr is stored as a temporary value on the AMX heap and its address is returned.
native Expression:expr_nameof(Expression:expr);Creates a new nameof expression. When executed, the expression returns the string representation of expr.
native expr_get(Expression:expr, offset=0);
native expr_get_arr(Expression:expr, AnyTag:value[], size=sizeof(value));
native expr_get_str(Expression:expr, value[], size=sizeof(value)) = expr_get_arr;
native String:expr_get_str_s(Expression:expr);
native Variant:expr_get_var(Expression:expr);
native bool:expr_get_safe(Expression:expr, &AnyTag:value, offset=0, TagTag:tag_id=tagof(value));
native expr_get_arr_safe(Expression:expr, AnyTag:value[], size=sizeof(value), TagTag:tag_id=tagof(value));
native expr_get_str_safe(Expression:expr, value[], size=sizeof(value));
native String:expr_get_str_safe_s(Expression:expr);Executes the expression and returns its value. An error may be raised if the expression is semantically incorrect.
native expr_set(Expression:expr, AnyTag:value, TagTag:tag_id=tagof(value));
native expr_set_arr(Expression:expr, const AnyTag:value[], size=sizeof(value), TagTag:tag_id=tagof(value));
native expr_set_str(Expression:expr, const value[]);
native expr_set_var(Expression:expr, ConstVariantTag:value);Executes the expression, and if the result corresponds to a storage location, sets its value. An error may be raised if the expression is semantically incorrect.