Anonymous

Module:TableTools: Difference between revisions

From Roses, Tulips, & Liberty
escape prefix and suffix strings in affixNums so that magic characters are interpreted literally
(add p.numData function)
(escape prefix and suffix strings in affixNums so that magic characters are interpreted literally)
Line 133:
checkType('affixNums', 2, prefix, 'string', true)
checkType('affixNums', 3, suffix, 'string', true)
 
local function cleanPattern(s)
-- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally.
s = s:gsub('([()%%.%[%]*+-?^$])', '%%%1')
return s
end
 
prefix = prefix or ''
suffix = suffix or ''
prefix = cleanPattern(prefix)
suffix = cleanPattern(suffix)
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$'
 
local nums = {}
for k, v in pairs(t) do
Cookies help us deliver our services. By using our services, you agree to our use of cookies.