summaryrefslogtreecommitdiff
path: root/testdata/scad/misc/parent_module-tests.scad
blob: 377764525f2bb98b38da61f2b863b3a5c34f436d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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();
contact: Jan Huwald // Impressum