17 lines
295 B
Lua
17 lines
295 B
Lua
--- @param list string[]
|
|
return function (list)
|
|
table.sort(list, function (a, b)
|
|
return #a > #b;
|
|
end);
|
|
|
|
--- @param src string
|
|
--- @param i integer
|
|
return function (src, i)
|
|
for j = 1, #list do
|
|
if src:sub(i, i + #list[j] - 1) == list[j] then
|
|
return list[j];
|
|
end
|
|
end
|
|
end;
|
|
end
|