Navigation menu

Module:Arguments/doc: Difference between revisions

From The Kodiak Republic Wiki

(→‎Recommended practice: make this easier to digest for idiots like me)
(→‎Recommended practice: add some more)
Line 50:
</syntaxhighlight>
 
The way this is called from a template is <code>{{#invoke:Example|main}}</code> (optionally with some parameters like <code>{{#invoke:Example|main|arg1=value1|arg2=value2}}</code>), and the way this is called from a module is <syntaxhighlight lang=lua inline>require('Module:Example')._main({arg1 = 'value1', arg2 = value2, 'spaced arg3' = 'value3'})</syntaxhighlight>. What this second one does is construct a table with the arguments in it, then gives that table to the p._main(args) function, which uses it natively.
 
=== Multiple functions ===
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.