You don't have to pass variables to the User Function. It can have it's own, but it will work with any variable the same way any code does.
Press the button count, and you will see a user function count how many letters are in the field. If you look at the code for the button you will see it doesn't do anything but trigger the user function.
The user function itself has the code that gives the function. Which in this case there's two lines, one that gets a value and populates a variable, and the second line displays the message containing the value stored in the variable.