Cambios

205 bytes eliminados ,  07:08 27 feb 2023
sin resumen de edición
Línea 7: Línea 7:  
local quality = tonumber(frame.args.q)
 
local quality = tonumber(frame.args.q)
 
local ulang = string.upper(frame.args.ll)
 
local ulang = string.upper(frame.args.ll)
local formattedresult
+
local result, formattedresult
    
if edibility == 0 then return 0 end
 
if edibility == 0 then return 0 end
    
if item == "energy" then
 
if item == "energy" then
formattedresult = mw.language.getContentLanguage():formatNum(calcenergy(edibility, quality))
+
result = calcenergy(edibility, quality)
 
else
 
else
formattedresult = mw.language.getContentLanguage():formatNum(calchealth(edibility, quality))
+
result = calchealth(edibility, quality)
 
end
 
end
 +
formattedresult = mw.language.getContentLanguage():formatNum(result)
   −
if tonumber(formattedresult) < 1000 then return formattedresult end
+
if ((result < 1000) or (ulang ~= "ES")) then return formattedresult end
if ulang ~= "ES" then return formattedresult end
     −
--[[THIS SHOULD NOT BE THIS DIFFICULT
  −
    WHERE IS THE SCRIBUNTO DOCUMENTATION
  −
    NOWHERE, NOWHERE, NOWHERE
  −
]]
   
--replace space with dot
 
--replace space with dot
 
--Problem: ES doesn't add a space for 4 digits
 
--Problem: ES doesn't add a space for 4 digits
local temp = {mw.ustring.gsub(tostring(formattedresult), "%s" , "")}  
+
local temp = {mw.ustring.gsub(tostring(result), "%s" , "")}  
temp2 = string.sub(tostring(temp[1]), -3)
+
local temp2 = string.sub(tostring(temp[1]), -3)
 
return string.sub(tostring(formattedresult), 1, #formattedresult-3) .. "." .. temp2
 
return string.sub(tostring(formattedresult), 1, #formattedresult-3) .. "." .. temp2
  −
  −
  −
--end
   
end
 
end
  
106 449

ediciones