Module:Utilities: Difference between revisionsGive feedback
Jump to navigation
Jump to search
added process_variables function |
removed non-number symbols except + or - from variables |
||
| Line 206: | Line 206: | ||
-- Get the value from ItemData | -- Get the value from ItemData | ||
local value = item_data_module.get_prop({args = {item_name, variable_name}}) | local value = item_data_module.get_prop({args = {item_name, variable_name}}) | ||
return value or variable_name -- Fallback to variable name if value not found | |||
-- If value exists, remove non-number symbols (but keep + and -) | |||
if value then | |||
-- Keep only digits (0-9), plus (+), and minus (-) | |||
value = value:gsub("[^0-9+-]", "") | |||
-- Return empty string if nothing left, otherwise return the filtered value | |||
return value ~= "" and value or variable_name | |||
else | |||
return variable_name -- Fallback to variable name if value not found | |||
end | |||
end) | end) | ||