User:Econterms/Lua practice


 * Lua training at Wikimania 2019

Example 1
If the module didn't have the p. syntax, we'd get an error about a "nil value" and an "export table" because of something about the Wikimedia implementation of Lua which is called Scribuntu. Arrays and lists are "tables" in Lua. All arguments to Lua and return values from Lua are strings.

Example 2
Example 2a:

Example 2b:    (Note functionality would be different for name="" or name=)

In this example we use a MediaWiki variable, the present page title:

Example 3
Converting from 10.5 Celsius: It's Fahrenheit

Example 4
Shows a loop: