2,736
edits
Red Leader (talk | contribs) No edit summary |
Red Leader (talk | contribs) (→attributes(): Finish) |
||
| Line 7: | Line 7: | ||
{{Nasal doc | {{Nasal doc | ||
|syntax = debug.attributes(p[, verbose[, color]]); | |syntax = debug.attributes(p[, verbose[, color]]); | ||
|text = Returns a string showing the attributes of the node, in the form <code>(''type''[, ''attr''[, L''num''[, #''refs'']])</code>. See the table below for explanation. | |text = Returns a string showing the attributes of the node, in the form <code>('''type'''[, '''attr'''[, L'''num'''[, #'''refs''']])</code>. See the table below for explanation. | ||
{{{!}} class="wikitable" | |||
! Data !! Meaning | |||
{{!-}} | |||
{{!}} type {{!!}} Type of node as returned by {{func link|getType()|props|Node}}. | |||
{{!-}} | |||
{{!}} attr {{!!}} Various attribute flags, see {{func link|getAttribute()|props|Node}}. "r" = read protected, "w" = write protected, "R" = trace read, "W" = trace write, "A" = archive, "U" = userarchive, "P" = preserve, and "T" = tied. | |||
{{!-}} | |||
{{!}} num {{!!}} Number of listeners, if any. | |||
{{!-}} | |||
{{!}} refs {{!!}} This argument will be shown if '''verbose''' is true. Tells the number of references to the node. Note that all nodes have two references by default, but this tells the number of extra references. | |||
{{!}}} | |||
|param1 = p | |param1 = p | ||
|param1text = Mandatory <code>props.Node</code> object. | |param1text = Mandatory <code>props.Node</code> object. | ||
| Line 15: | Line 26: | ||
|param3 = color | |param3 = color | ||
|param3text = Optional bool specifying whether to output the string with an {{wikipedia|ANSI escape code#Colors|ANSI color code}}. Defaults to <code>'''nil'''</code>. | |param3text = Optional bool specifying whether to output the string with an {{wikipedia|ANSI escape code#Colors|ANSI color code}}. Defaults to <code>'''nil'''</code>. | ||
|example1 = | |example1 = var node = props.globals.getNode("/sim/time/gmt"); | ||
print(debug.attributes(node)); # prints "(STRING, AT, #1)" - string, archive, tied, 1 extra ref | |||
|example2 = var node = props.Node.new(); | |||
node.setIntValue(12); | |||
node.setAttribute(17); | |||
print(debug.attributes(node)); # prints "(INT, wR)" - integer, write protected, trace read | |||
|example3 = var node = props.globals.getNode("/sim/signals/fdm-initialized"); | |||
print(debug.attributes(node)); # prints "(BOOL, L6, #16)" - bool, 6 listeners, 16 extra refs | |||
}} | }} | ||
=== backtrace() === | === backtrace() === | ||