return function(S,I)assert(typeof(S)=="\115\116\114\105\110\103","\065\114\103 \049 \109\117\115\116 \098\101 \097 \115\116\114\105\110\103\044 \103\111\116 "..typeof(S))assert(typeof(I)=="\116\097\098\108\101","\065\114\103 \050 \109\117\115\116 \098\101 \097 \116\097\098\108\101\044 \103\111\116"..typeof(I))local z={}for I,f in ipairs(I)do if f[S]~=nil then z[f[S]]=f else warn(("\105\116\101\109 \037\115 \097\116 \091\037\100\093 \104\097\115 \110\111 \107\101\121 \037\115"):format(tostring(f),I,tostring(S)))end end return z end
return function(keyName, tbl)
    assert(typeof(keyName)=="string", "Arg 1 must be a string, got "..typeof(keyName))
    assert(typeof(tbl)=="table", "Arg 2 must be a table, got"..typeof(tbl))

    local new = {}

    for idx,v in ipairs(tbl) do
        if v[keyName] ~= nil then
            new[v[keyName]] = v
        else
            warn(("item %s at [%d] has no key %s"):format(tostring(v), idx, tostring(keyName)))
        end
    end

    return new
end