I've been reading some online articles on the concept of "function", but I'm not very sure about it.
An ashtray, according to my dictionary, is a "container for cigarette ash", but I don't know what this "for" means.
It can't mean that people ought to put ashes in the ashtray, because there are other places where we may put it. And it can't mean that people may put there the ashes, since, once again, we may put the ashes in places which are not ashtrays. It can't either mean that the ashtray was made "with the purpose" of serving as a container for the ashes, because an object may be an ashtray now but haven't been made to be an ashtray.
So, what is an ashtray?
You're right to suspect that the idea of function is somewhat unclear--at least in most uses. In one sense, a thing may be said to "perform a function" just in case it does whatever it is that is within the description of the function. So, a highball glass can "perform the function" of an ashtray, because it can do what we ordinarily associate with the ashtray--that is, serve as a receptacle for ashes. Something made to be an ashtray would be an object for which serving as a receptacle for ashes would be its "intended function." The intended function of a highball glass (whose intended function was to be a drink container of a certain size and shape) is not to be a receptacle of ashes. So the object whose intended function was X may end up performing some other function. Now one way in which things can shift functions is because beings capable of forming intentions can decide to change the functions the objects serve, either temporarily or permanently. So we can turn an old tire into a...