update changelist
[QuestHelper.git] / collect_patterns.lua
blob21699c7bed36c286bb2a7a4651f82222f9a06d5e
1 QuestHelper_File["collect_patterns.lua"] = "Development Version"
2 QuestHelper_Loadtime["collect_patterns.lua"] = GetTime()
4 local patterns = {}
6 function MakePattern(label, newpat)
7 if not newpat then newpat = ".*" end
8 if not patterns[label] then patterns[label] = "^" .. string.gsub(_G[label], "%%s", newpat) .. "$" end
9 end
11 function MakeNumberSnag(label)
12 if not patterns[label] then patterns[label] = string.gsub(_G[label], "%%d", "([0-9,.]+)") end
13 end
15 function QH_Collect_Patterns_Init(QHCData, API)
16 API.Patterns = patterns
17 API.Patterns_Register = MakePattern
18 API.Patterns_RegisterNumber = MakeNumberSnag
19 end