UI button's logic as function, defined outside button script

Hello, I am new to Defold and I need to create buttons for my UI.
Is there any way to make one script file for basic button logic and make button’s behaviour in specific function which is also a parameter, so, I might make many buttons from it with different, situation-ly defined in other scripts, logic?
I tried make pass function with message to my button but the type “function” can’t be passed, as I understand from error.
Hope someone will help me because I rally don’t want to make script files for each type of button in my game