I use this function to make sure only things with "Coin" in their name can go into a specific bag.

Code:
function filterObjectEnter(obj)
    local name = obj.getName()

    if type(name) != 'string' then return false end

    return name:find('Coin') != nil
end
If I multi-select a Coin and something that is not a Coin, and then I drag the Coin into the purse, both objects enter the bag.