Jump to content

Module:DataValue

Unchecked
From Wikipedia

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

local DataValue = {}

local supportedDataValues = {
	["string"] = "StringValue"
}

--[[
    Build a new DataValue from its serialization including the type
    @param table serialization
    @return DataValue|nil
]]--
function DataValue.newFromSerialization( serialization )
	if serialization['type'] ~= nil or supportedDataValues[serialization['type']] ~= nil then
		return nil
	end

	return ( require 'Module:' .. supportedDataValues[serialization[key]] ).newFromSerialization( serialization['value'] )
end

--[[
    Return the DataValue as a string in the given language
    @param mw.language|string|nil language to use. By default the content language.
    @return string
]]--
function DataValue:toString( language )
    return error( 'the toString method should be implemented' )
end

--[[
    Returns the DataValue in Wikitext in the given language
    @param mw.language|string|nil language to use. By default the content language.
    @return string
]]--
function DataValue:toWikitext( language )
    return self:toString( language )
end

--[[
    Returns the type of the Datavalue
    @return string
]]--
function DataValue:getType()
    return error( 'the type method should be implemented' )
end

return GlobeCoordinate