Moduł:utils: Różnice pomiędzy wersjami
[wersja przejrzana] | [wersja przejrzana] |
Usunięta treść Dodana treść
Nie podano opisu zmian |
(test) optymalizacja kodu w p.countSubstring(), uzycie mw.ustring powodowalo przekroczenie limitu czasu pracy Lua w Olafbot/SK (Specjalna:Diff/5014055) |
||
Linia 78:
function p.countSubstring( mainString, subString )
local count, offset, _ = -1, 0
local tab = mw.text.split( mainString, subString, true )▼
local find
return #tab - 1▼
if mw.ustring.len( subString ) == string.len( subString ) then
find = string.find
else
find = mw.ustring.find
end
repeat
count = count + 1
until offset == nil
end
|