विकिपीडिया:लुआ: रिवीजन सभ के बीचा में अंतर

Content deleted Content added
→‎Labeling converted templates: add a parameter to {{lua}}
imported>Nnemo
No edit summary
लाइन 2:
{{Information page|WP:Lua}}
{{Namespaces}}
 
[[Lua (programming language)|Lua]] is a programming language that is now available, via the [[mw:Extension:Scribunto|Scribunto]] MediaWiki extension, on the English Wikipedia. Lua code can now be embedded into wiki templates by employing the "<nowiki>{{#invoke:}}</nowiki>" functionality of the Scribunto MediaWiki extension.
 
The Lua [[source code]] is stored in pages called modules (e.g., [[Module:Bananas]]). These individual modules are then invoked (by code <code><nowiki>{{#invoke:}}</nowiki></code>) on template pages (e.g., [[Module:Bananas/doc]] uses the code <code><nowiki>{{#invoke:Bananas|hello}}</nowiki></CODEcode> to print the text "Hello, world!").
 
== Running a module ==
 
Modules are run on normal wiki pages using the #invoke parser function. The syntax of #invoke is similar to template syntax, but with some differences. The most important difference is that you need to specify a ''function name''. A function is a set of instructions that takes input values, processes them, and returns an output value.<ref>You can also have multiple output values, but functions that do this are not normally meant to be accessed from wiki pages.</ref> This is much like what a template does: you give it arguments, it processes them, and you get a result. However, you can define many functions in one Lua module, whereas you can only define one template on one page.