Module:Sandbox/LVL: Difference between revisions

Jump to navigation Jump to search
LVL (talk | contribs)
No edit summary
LVL (talk | contribs)
No edit summary
Line 203: Line 203:


     local val_str = tostring(value)
     local val_str = tostring(value)
    ------------------------------------------------------------------
    -- CSS-specific formatting
    ------------------------------------------------------------------
    if css == "move_speed" or css == "sprint_speed" then
        if postfix == "" or not postfix:find("%%") then
            val_str = val_str:gsub("/s", "") .. "/s"
        end
        local num = tonumber(val_str:match("^-?%d+%.?%d*"))
        if num and num > 0 and not val_str:find("^%+") then
            val_str = "+" .. val_str
        end
    end


     ------------------------------------------------------------------
     ------------------------------------------------------------------
Line 228: Line 215:
         else
         else
             val_str = prefix..val_str
             val_str = prefix..val_str
        end
    end
   
    ------------------------------------------------------------------
    -- CSS-specific formatting
    ------------------------------------------------------------------
    if css == "move_speed" or css == "sprint_speed" then
        if postfix == "" or not postfix:find("%%") then
            val_str = val_str:gsub("/s", "") .. "/s"
        end
        local num = tonumber(val_str:match("^-?%d+%.?%d*"))
        if num and num > 0 and not val_str:find("^%+") then
            val_str = "+" .. val_str
         end
         end
     end
     end