Module:Ref: Difference between revisions

From Halopedia, the Halo wiki

(Created page with "local ref = {} function ref.ref( text, group, id ) local args = {} if group ~= nil and group ~= '' then args.group = group end if id ~= nil and id ~= '' then args.nam...")
 
No edit summary
Line 2: Line 2:


function ref.ref( text, group, id )
function ref.ref( text, group, id )
text = tostring( text )
local args = {}
local args = {}
if group ~= nil and group ~= '' then
if group ~= nil and group ~= '' then
args.group = group
args.group = tostring( group )
end
end
if id ~= nil and id ~= '' then
if id ~= nil and id ~= '' then
args.name = id
args.name = tostring( id )
end
end
local frame = mw.getCurrentFrame()
local frame = mw.getCurrentFrame()

Revision as of 15:17, April 25, 2021

vde
Lua Module Documentation

This module provides the backend implementations of the Ref templates.

Public Functions

ref.ref

Code

A copy of the code for this module follows:


local ref = {}

function ref.ref( text, group, id )
	text = tostring( text )
	local args = {}
	if group ~= nil and group ~= '' then
		args.group = tostring( group )
	end
	if id ~= nil and id ~= '' then
		args.name = tostring( id )
	end
	local frame = mw.getCurrentFrame()
	return frame:extensionTag( 'ref', text, args )
end

return ref