mirror of https://github.com/vitalif/openscad
Added test case for parent_module()
parent
0860dfda3e
commit
0f22d6e9ad
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
$parent_modules should return the number of module in the module
|
||||
instantiation stack. The stack is independent on where the modules
|
||||
are defined. It's where they're instantiated that counts.
|
||||
|
||||
parent_module(N) returns the Nth module name in the stack
|
||||
*/
|
||||
module print(name) {
|
||||
echo("name: ", name);
|
||||
for (i=[1:$parent_modules-1]) echo(parent_module(i));
|
||||
}
|
||||
|
||||
module yyy() {
|
||||
print("yyy");
|
||||
}
|
||||
|
||||
module test() {
|
||||
module xxx() {
|
||||
print("xxx");
|
||||
yyy();
|
||||
}
|
||||
print("test");
|
||||
xxx();
|
||||
}
|
||||
|
||||
test();
|
Loading…
Reference in New Issue