Merge pull request #1 from Gael-de-Sailly/deco_fix

Small fix: add function "table.contains_substring"
master
Shad MOrdre 2018-01-22 19:54:41 -08:00 committed by GitHub
commit 83fae8d0cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -1,4 +1,19 @@
function table.contains_substring(t, s)
if type(s) ~= "string" then
return nil
end
for key, value in pairs(t) do
if type(value) == 'string' and s:find(value) then
if key then
return key
else
return true
end
end
end
return false
end
-- Copy all the decorations except the ones I don't like.
-- This is currently used to remove the default trees.