I'm not sure if this is by coincidence or not (as it may be just
treated as the same value, which means that the sort order will be
arbitrarily picked between 012 and 12), but it should be easy to fix
the logic if you want a specific order; just add the length:
function alphanumsort(o)
local function padnum(d) return
("%012d"):format(d)..("%02d"):format(12-#d) end
table.sort(o, function(a,b)
return tostring(a):gsub("%d+",padnum)< tostring(b):gsub("%d+",padnum) end)
return o
end
Use format(12-#d) if you want 012 before 12 or format(#d) if you want
12 before 012 (this is assuming the length is 12 or less). I'll update
the blog post to reflect this.