Nasal library/debug: Difference between revisions

Jump to navigation Jump to search
→‎Functions: Doc warn() and tree()
(→‎Functions: Doc warn() and tree())
Line 310: Line 310:
=== tree() ===
=== tree() ===
{{Nasal doc
{{Nasal doc
|syntax = debug.tree();
|syntax = debug.tree([n[, graph]);
|text =  
|text = Dumps all the nodes under a given property node into the console.
|param1 =  
|param1 = n
|param1text =  
|param1text = Optional node to dump from. May be a <code>props</code> ghost, string, or <code>props.Node</code> object. If not given, the default is the entire [[Property Tree]].
|example1 =  
|param2 = graph
|param2text = Optional boolean specifying whether to graph the properties in "flat" mode or using spaces. Defaults to 1 (use spaces).
|example1 = debug.tree("/position");
|example2 = debug.tree("/position", 0);
}}
}}


=== warn() ===
=== warn() ===
{{Nasal doc
{{Nasal doc
|syntax = debug.warn();
|syntax = debug.warn(msg[, level]);
|text =  
|text = Similar to {{func link|die()}}, but the execution of the code does not stop.
|param1 =  
|param1 = msg
|param1text =  
|param1text = Message to print
|example1 =  
|param2 = level
|param2text = Optional number of calling levels to omit
|example1 = var check = func(pressure){
    if (pressure > 120){
        debug.warn("Pressure above 120 may cause system failure");
    }
}
check(130);
|example2 = var A = func(a){
    B(a);
}
var B = func(b){
    if (b > 120){
        debug.warn(b ~ " is not within limits", 2);
    }
}
A(130);
}}
}}


{{Nasal namespaces}}
{{Nasal namespaces}}

Navigation menu