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 result, formattedresult | + | local result, formattedresult, temp |
| | | |
| if edibility == 0 then return 0 end | | if edibility == 0 then return 0 end |
Línea 21: |
Línea 21: |
| | | |
| --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, only for 5+ |
− | local temp = {mw.ustring.gsub(tostring(formattedresult), "%s" , ".")} | + | |
− | --local temp2 = string.sub(tostring(temp[1]), -3)
| + | if (result < 10000) then |
− | --return string.sub(tostring(formattedresult), 1, #formattedresult-3) .. "." .. temp2
| + | temp = string.sub(tostring(result), -3) |
− | return temp[1] | + | return string.sub(temp, 1, (#temp-3)) .. "." .. temp |
| + | else |
| + | temp = {mw.ustring.gsub(tostring(formattedresult), "%s" , ".")} |
| + | return temp[1] |
| + | end |
| end | | end |
| | | |