| Line 4: |
Line 4: |
| | | | |
| | function NanaminFunctions.split(haystack, needle) | | function NanaminFunctions.split(haystack, needle) |
| | + | local special_inputs = { |
| | + | "381mm/50 Triple Gun Mount", |
| | + | "381mm/50 Triple Gun Mount Kai", |
| | + | } |
| | local result = {} | | local result = {} |
| | while mw.ustring.find(haystack, needle) do | | while mw.ustring.find(haystack, needle) do |
| | local split = mw.ustring.find(haystack, needle) | | local split = mw.ustring.find(haystack, needle) |
| − | table.insert(result, mw.ustring.sub(haystack, 1, split - 1)) | + | local input = mw.ustring.sub(haystack, 1, split - 1) |
| | + | |
| | + | for _, value in pairs(special_inputs) do |
| | + | if mw.ustring.sub(haystack, 1, #value) == value then |
| | + | input = mw.ustring.sub(haystack, 1, #value) |
| | + | haystack = mw.ustring.sub(haystack, split + 1) |
| | + | split = mw.ustring.find(haystack, needle) or 0 |
| | + | break |
| | + | end |
| | + | end |
| | + | |
| | + | table.insert(result, input) |
| | haystack = mw.ustring.sub(haystack, split + 1) | | haystack = mw.ustring.sub(haystack, split + 1) |
| | + | if split == 0 then haystack = "" end |
| | end | | end |
| − | table.insert(result, haystack) | + | if haystack ~= "" then table.insert(result, haystack) end |
| | return result | | return result |
| | end | | end |