Line 75: |
Line 75: |
| | | |
| function Ship:process_ship_key(ship_key) | | function Ship:process_ship_key(ship_key) |
− | -- [[Category:Todo]]: rfind?
| |
| local split = mw.ustring.find(ship_key, '/') | | local split = mw.ustring.find(ship_key, '/') |
| local ship_base_name, ship_suffix | | local ship_base_name, ship_suffix |
Line 81: |
Line 80: |
| ship_base_name = ship_key | | ship_base_name = ship_key |
| else | | else |
− | local split2 = mw.ustring.find(ship_key, '/', split + 1)
| + | ship_base_name = split - 1 > 0 and mw.ustring.sub(ship_key, 1, split - 1) or '' |
− | if split2 == nil then
| + | ship_suffix = mw.ustring.sub(ship_key, split + 1, -1) |
− | ship_base_name = split - 1 > 0 and mw.ustring.sub(ship_key, 1, split - 1) or ''
| |
− | ship_suffix = mw.ustring.sub(ship_key, split + 1, -1)
| |
− | else
| |
− | ship_base_name = split2 - 1 > 0 and mw.ustring.sub(ship_key, 1, split2 - 1) or ''
| |
− | ship_suffix = mw.ustring.sub(ship_key, split2 + 1, -1)
| |
− | end
| |
| end | | end |
| return ship_base_name, ship_suffix | | return ship_base_name, ship_suffix |