Module:Utilities: Difference between revisions

Jump to navigation Jump to search
m Added helper for checking str is in array
LVL (talk | contribs)
Fix decimal point stripping
Line 216: Line 216:
         if value then
         if value then
             -- Keep only digits (0-9), plus (+), and minus (-)
             -- Keep only digits (0-9), plus (+), and minus (-)
             value = value:gsub("[^0-9+-]", "")
             value = value:gsub("[^0-9+.-]", "")
             -- Return empty string if nothing left, otherwise return the filtered value
             -- Return empty string if nothing left, otherwise return the filtered value
             return value ~= "" and value or variable_name
             return value ~= "" and value or variable_name