AutoPatrol, Bureaucrats, Administrators
481
edits
(Created page with "__NOTOC__ Get value of node's custom attribute. Function returns requested attribute's value on success or NULL if given attribute does not exist. == Syntax == SetCustomAttri...") |
m (Text replacement - "^" to "{{deprecated}}") |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | {{deprecated}}__NOTOC__ | ||
Set value of objects custom attribute. If attribute was not defined, it will be created. | |||
'''Since:''' 1.1.1 | |||
== Syntax == | == Syntax == | ||
SetCustomAttribute( | SetCustomAttribute(''object'', ''attributeName'', ''value'') | ||
== Parameters == | == Parameters == | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| | | ''object'' || Any object of [[NXSL_Class_Reference|NetObj class]], or its sub-classes. | ||
You can use predefined variable $node to refer to current node. You can also use null as node if trusted nodes check is disabled (see [[SG:Security Issues|Security Issues]] for more information). | |||
|- | |- | ||
| attributeName || Custom attribute name. | | ''attributeName'' || Custom attribute name. | ||
|- | |- | ||
| value || New value for custom attribute. | | ''value'' || New value for custom attribute. | ||
|} | |} | ||
== Return Value == | == Return Value == | ||
Previous value of custom attribute or '''NULL''' if attribute was not defined before. | Previous value of requested custom attribute or '''NULL''' if attribute was not defined before. | ||
== Examples == | == Examples == | ||
SetCustomAttribute($node, "my_attribute", "new value") -> "old value" | SetCustomAttribute($node, "my_attribute", "new value") -> "old value" | ||
SetCustomAttribute($node, "non_existing_attribute", "new value") -> NULL | |||
SetCustomAttribute($node, "non_existing_attribute", "new value") -> NULL |