fix that li'l spacing issue
[QuestHelper.git] / collect_merger.lua
blobd2f4df5e9cb563c524c76ee94261dc7fd917a256
1 QuestHelper_File["collect_merger.lua"] = "Development Version"
2 QuestHelper_Loadtime["collect_merger.lua"] = GetTime()
5 local function Add(self, data, stoprepeat) -- NOTE: if you're getting errors about adding tables, you probably did Merger:Add instead of Merger.Add
6 if stoprepeat and #self > 0 and string.sub(self[#self], -#data) == data then return end
7 table.insert(self, data)
8 for i = #self - 1, 1, -1 do
9 if string.len(self[i]) > string.len(self[i + 1]) then break end
10 self[i] = self[i] .. table.remove(self, i + 1)
11 end
12 end
13 local function Finish(self, data)
14 for i = #self - 1, 1, -1 do
15 self[i] = self[i] .. table.remove(self)
16 end
17 return self[1] or ""
18 end
20 QH_Merger_Add = Add
21 QH_Merger_Finish = Finish
23 function QH_Collect_Merger_Init(_, API)
24 API.Utility_Merger = {Add = Add, Finish = Finish}
25 end