localp={}functionp.State(frame)localpframe=frame:getParent()localconfig=frame.args-- the arguments passed BY the template, in the wikitext of the template itselflocalargs=pframe.args-- the arguments passed TO the template, in the wikitext that transcludes the templatelocalstatecheck=config[1]-- check if first or second statelocalstate-- initialise variableifstatecheck=="State1"thenstate=args["state"]or""-- get stateelsestate=args["state2"]or""-- get state (2nd state)endlocallinkpass=state-- create untouched variable to pass wikitext link (if needed)state=string.lower(state)-- change state to lower caselocallinks={act="[[Australian Capital Territory]]",jbt="[[Jervis Bay Territory]]",nsw="[[New South Wales]]",nt="[[Northern Territory]]",qld="[[Queensland]]",sa="[[South Australia]]",tas="[[Tasmania]]",vic="[[Victoria (Australia)|Victoria]]",wa="[[Western Australia]]"}ifstatecheck=="State1"thenreturnlinks[state]orlinkpassornil-- if first state no need for dashelseifstate==""thenreturnnil--return nil for 2nd state if none exists (first state is handled in code above, but code below cannot concatenate a null value)elseiflinks[state]thenreturn" – "..links[state]-- return premade link if not a wikitext linkelsereturn" – "..linkpass-- return wikitext link if all else failsendendreturnp