UI Button click event through script

Well i am creating an inventory system that is likea a scrollview, and in that scroll view, i have buttons which are put in there at runtime, i want to ( at runtime) add a unity event to those buttons that triggers the UseItem, which sends a string or maybe a int to determine what is being clicked.

create an empty object in the hierarchy then add a script to the object as a component
edit the script and this should get you started

public void FuctionName(parameters if any go here){
//code to execute
}

on your button in the onclick select your empty gameobject and then select the function and when the button is clicked in the game it will execute the function