Multiple transclusion
When the Lua function frame:expandTemplate
is used, this doesn’t create the new frame corresponding to the template expansion, but affect to the expanded template the "top" frame.
I
- (here: FirstTemplate, parentFrame:Template:FirstTemplate)
- (here: SecondTemplate, parentFrame:Template:SecondTemplate)
- end
II
- (here: FirstTemplate, parentFrame:Template:FirstTemplate)
- (here: SecondTemplate, parentFrame:Template:SecondTemplate)
- end
In {{FirstTemplate}}, Lua is invoked in the case I to "expandTemplate" {{SecondTemplate}}, and in the case II to "preprocess" {{SecondTemplate}}.
When frame:getParent():getTitle()
is called in each template, the case II always returns the caller of #invoke
, but in the case I the second transclusion shows the top frame (this page) as the caller of #invoke
.