Module:Constants

local p = {}

local Constants = mw.loadData("Module:Constants/Data")

function p.Main(frame) if frame.args[1] == nil then error("No constant name provided") end local constant local path for i, key in ipairs(frame.args) do		if i == 1 then constant = Constants[key] path = key else constant = constant and constant[key] path = path.."."..key end end if constant == nil then error(string.format("Constant '%s' does not exist", path)) end return constant end

return p