Board Thread:Lua Help/@comment-168424-20160330190659

I'm thinking of something like maybe an FAQ or separate pages in this form:

Problem
Read parameters passed to template with no value as boolean for true (default is false).

Lua fragment
&lt;pre&gt; local p = {} -- include Arguments module at dev.wikia.com local getArgs = require('Dev:Arguments').getArgs

function p.myTemplate(frame) -- Implements local args = getArgs(frame, {	trim = false,	removeBlanks = false -- Keeps empty params	}) local booleanVar = false -- Default booleanVar to false

-- Set booleanVar to true if |bool= used with template if args["bool"] then booleanVar = true end

return p._myTemplate(args, booleanVar) end

function p._myTemplate( args, isBool ) local localBool = isBool -- Set local boolean variable local returnWikitext = nil

-- Do stuff that is conditional on isBool and set returnWikitext

return returnWikitext end &lt;/pre&gt;

What do people think? It's a bit easier than full demo modules and would be faster to scan for solutions. 