Jump to content
Wikipedia The Free Encyclopedia

Module:Sandbox/DePiep/iso

From Wikipedia, the free encyclopedia
Module documentation[create] [purge]
You might want to create a documentation page for this Scribunto module.
Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this module.
 local p = {}
 local getArgs = require('Module:Arguments').getArgs

 local t1 = {}
 local t2 = {}

 local function printTable( t )
	local s = ''
	for k, v in pairs( t ) do
 	s = s .. k ..'=' .. tostring( v ) .. ', '
	end
	return s .. '.'
 end

 function p.isotopeRow( frame )
	local args = getArgs( frame )
	t1['id'] = args['sym'] .. '-' .. args['mn']
	t1['hl'] = args['hl']
	t1['na'] = args['na']
	t1['n'] = args['n']
	t1['mn'] = args['mn']
	t1['sym'] = args['sym']

	local dmPattern = '^dm%d?$'
	local dePattern = '^de%d?[ab]?$' -- 3 (2 2 1)
	local i = 0
	local j = 0
	for k, v in pairs( args ) do
		if mw.ustring.find(tostring(k), dmPattern) then
			i = i + 1
		end
		if mw.ustring.find(tostring(k), dePattern) then
			j = j + 1
		end
	end
	t1['decayCount'] = math.max( i, j )
	return "* Hello row " .. t1['id'] .. ': <br/>' .. printTable( t1 )
 end

 return p

AltStyle によって変換されたページ (->オリジナル) /