Module:TableTools: Difference between revisions
From Roses, Tulips, & Liberty
Content added Content deleted
(use a hack to handle NaN values) |
(p.affixNums: move the pattern-generating code out of the loop) |
||
Line 135: | Line 135: | ||
prefix = prefix or '' |
prefix = prefix or '' |
||
suffix = suffix or '' |
suffix = suffix or '' |
||
local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$' |
|||
local nums = {} |
local nums = {} |
||
for k, v in pairs(t) do |
for k, v in pairs(t) do |
||
if type(k) == 'string' then |
if type(k) == 'string' then |
||
local num = mw.ustring.match(k, |
local num = mw.ustring.match(k, pattern) |
||
if num then |
if num then |
||
nums[#nums + 1] = tonumber(num) |
nums[#nums + 1] = tonumber(num) |