Module:ChemElem

From Omniversalis

Documentation for this module may be created at Module:ChemElem/doc

local p = {}
local getArgs = require('Module:Arguments').getArgs
local tableTools = require('Module:TableTools')
local htmlBuilder = require('Module:HtmlBuilder')
local datapageElementIdToZ = 'Module:ChemElem/data/elementIdToZ'

function p.elementIdToZ(frame)
--load elementIdToZ
	local args = getArgs(frame)
    return p._elementIdToZ(args)
end

function p._elementIdToZ(args)
	local dataElementIdToZ = mw.loadData(datapageElementIdToZ)
	local hit = 'nope'
	local searchId = mw.ustring.lower(mw.ustring.gsub(args[1] or -1, '[%s]', ''))
	Z = 'nope'
	if tonumber(args[1]) == nil then
		for s, v in pairs(dataElementIdToZ) do
			if searchId == s then
				Z = v
			end
		end
	else
		Z = args[1]
	end
    return 'hello1. IN:' .. args[1] .. ' => ' .. Z .. ' (from:' .. #dataElementIdToZ ..')'
    
end

return p