Modulo:FunzioniGeneriche: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
TItles in example output
Nessun oggetto della modifica
(TItles in example output)
(3 versioni intermedie di uno stesso utente non sono mostrate)
Riga 20: Riga 20:


     local Intro = 'Questo esempio è automaticamente generato tramite script LUA a partire dal codice di esempio presente in <code>[[' .. SubPageTitle.prefixedText .. ']]</code>'
     local Intro = 'Questo esempio è automaticamente generato tramite script LUA a partire dal codice di esempio presente in <code>[[' .. SubPageTitle.prefixedText .. ']]</code>'
     local CodeString = 'Il codice'
     local CodeString = '=== Il codice ==='
     local ReturnString = 'restituisce'
     local ReturnString = '=== restituisce ==='


Content = SubPageTitle:getContent()
Content = SubPageTitle:getContent()
Riga 102: Riga 102:
local hex = string.sub(frame.args[1], 2)
local hex = string.sub(frame.args[1], 2)
local R, G, B
local R, G, B
local L
     if hex:len() == 3 then
     if hex:len() == 3 then
       --return (tonumber("0x"..hex:sub(1,1))*17)/255, (tonumber("0x"..hex:sub(2,2))*17)/255, (tonumber("0x"..hex:sub(3,3))*17)/255
       --return (tonumber("0x"..hex:sub(1,1))*17)/255, (tonumber("0x"..hex:sub(2,2))*17)/255, (tonumber("0x"..hex:sub(3,3))*17)/255
Riga 113: Riga 115:
     end
     end
      
      
     return (R * 0.299 + G * 0.587 + B * 0.114) / 256
     L = (R * 0.299 + G * 0.587 + B * 0.114) --/ 256
    if L < 0.5 then
    return "white"
    else
    return "black"
    end
end
end
return p
return p

Menu di navigazione