Lua templating/Snippets

This page contains some quick Lua snippets to help create modules.
== General ==
Get template and transcluding page arguments
Check if a lua table contains values.
Get the title of the page that transcludes a page containing a lua invocation (parent frame). This is typically a template name.
Get parameters (bool= in example) passed to template that have no value and read them to set boolean variables (or just localBool in this example).
== Text ==
Find a piece of text within text.
Show only a specific number of sequential tokens (group of characters) from a piece of text.
== Math ==
Round a number.
== Date ==
Add days to a date.
== Conditional statements ==
Using a ternary operator.
== Sorting ==
Sorting using an Associative tableSort a Table[] in Lua. http://stackoverflow.com/a/15706820
Usage
== See also ==
* Module:Stats
* 
== References ==
Category:Lua