It sounds like you have multiple objects with variables so you should be able to destroy them when you need without using this method, especially because if you are going to be able to pass the name that means you should be able to destroy it anyway.
Something like:
If item1 var_amount = 0 destroy item 1
If item2 var_amount = 0 destroy item 2
Or if you are using paid version you can use a family and add all the inventory items:
If family"items" var_amount = 0 destroy items
However if you want to pass a string to a function, in the event that you call the function, before the function call action, store the name in a local/global variable, and then check that variable inside the function, and at the end of the function clear the variable.