LTSpice: how do I pass to a function a component name as parameter?
There are two problems here, I couldn't get a user defined function to work in the graph. The other one is your trying to make a function that passes in a parameter, when you can only use them to pass numerical information. 

The other one is you can't reference a pin current anywhere but a graph, so if your using the colons, that won't work. The way to reference a pin current is described in a few answers like this one. The short answer is if you want to reference a pin current is with a zero ohm resistor or 0V voltage source and then measuring the current (ie: for a resistor called R2, you can do this I(R2), but not this I(R2:1)) 

You can't use use user defined functions graphically, you can use them in b sources and other areas in the spice file. If the need arises where a function needs to be graphed, use a b-source to convert the function to data that can be graphed. Inconvenient, but that's the way it is, and is unlikely to change do to the way LT spice works.