Skip to content

Tag natives

IS4 edited this page Oct 10, 2021 · 4 revisions

tag_uid

native tag_uid:tag_uid(tag_id);

Returns the universal identifier of a tag. The returned value can be used in all scripts to refer to the same tag.

tag_id

native tag_id(tag_uid:tag_uid);

Returns the local identifier of a tag (i.e. the result of tagof). A valid tag has always the highest bit set, so mask it with 0x7FFFFFFF for comparisons. Returns 0 for invalid tags only.

tag_name

native tag_name(tag_uid:tag_uid, name[], size=sizeof(name));

Returns the name of a tag, identified by its universal identifier. Returns the length of the name.

tag_name_s

native String:tag_name_s(tag_uid:tag_uid);

Returns the name of a tag, as a dynamic string.

tag_base

native tag_base(tag_uid:tag_uid);

Returns the base the tag is derived from. The name of the tag in a Pawn script specifies its base by appending @ and a subname to it.

tag_derived_from

native bool:tag_derived_from(tag_uid:tag_uid, tag_uid:base_uid);

Returns true if a specific tag is derived from another, either directly or indirectly. All tags ultimately derive from tag_uid_unknown.

tag_find

native tag_uid:tag_find(const name[]);

Attempts to find a tag by its name. Returns tag_uid_unknown if the tag is not registered.

tag_new

native tag_uid:tag_new(const name[], tag_uid:base=tag_uid_unknown);

Creates a new tag with a custom name and base. This tag will be always unique, regardless of the name, and will be accessible from all scripts via its uid. Tags cannot be deleted.

tag_set_op

native bool:tag_set_op(tag_uid:tag_uid, tag_op:tag_op, const handler[], const additional_format[]="", AnyTag:...);

Sets a new handler to be used when an operation is dynamically performed on values with the specific tag. Only custom tags may have their operations changed (i.e. those not recognized by standard Pawn or PawnPlus). tag_op may be any number, even one not assigned to any standard operation.

tag_set_op_expr

native bool:tag_set_op_expr(tag_uid:tag_uid, tag_op:tag_op, Expression:handler);

Like tag_set_op, but uses an expression as the handler for the operation. All arguments passed to the expression have the cell type. The lifetime of the expression is prolonged until the operation is replaced.

tag_lock

native bool:tag_lock(tag_uid:tag_uid);

Locks a tag, preventing its operations from changes forever.

tag_call_op

native tag_call_op(tag_uid:tag_uid, tag_op:tag_op, AnyTag:...);

Dynamically calls a tag operation on a number of values.

tag_element

native tag_uid:tag_element(tag_uid:tag_uid);

Returns the tag that is referenced as an element tag of a generic tag, e.g. returns Float for List<Float>.

Clone this wiki locally