Mòdul:Proves/Vriullop
Documentació del mòdul [ mostra ] [ modifica el codi ] [ mostra l'historial ] [ refresca ]
A continuació es mostra la documentació transclosa de la subpàgina /ús. [salta a la caixa de codi]
local p = {}
function p.test()
return require('Module:Wikidades').claim{item='Q151904',property='P179',references='y',formatting='table',qualifier='P155',qualifier2 = 'P156', qualifier3 = 'P1545', rowformat = '* $0 ($3) <br/> $1 * $2', rowsubformat1 = '← $1', rowsubformat2 = '$2 →<br/>'}
end
-- Engineering notation
-- Credit to https://stackoverflow.com/questions/17973278 cc-by-sa-4.0
function p.engNotation(frame)
local x = tonumber(frame.args[1])
local sign = ''
if x < 0 then
x = math.abs(x)
sign = '-'
end
local exp = math.floor(math.log10(x))
local exp3 = exp - (exp % 3)
local x3 = x / (10 ^ exp3)
local exp3_text
if exp3 == 0 then
exp3_text = ''
elseif exp3 >= -24 and exp3 <= 24 then
local index = (exp3 - (-24)) / 3 + 1
exp3_text = ' ' .. mw.ustring.sub('yzafpnµm kMGTPEZY', index, index)
else
exp3_text = ' e' .. tostring(exp3)
end
return sign .. tostring(x3) .. exp3_text
end
return p