Topic was automatically imported from the old Question2Answer platform.
Asked By
Chevi
I have a button that emits the signal “roll_a_dice(0, 20)” and a number gets chosen from 0 to 20, but how do I get the “return roll” at the bottom of the “roll_a_dice()” signal?
In the function, couldn’t you just store the number chosen in a variable and then write return rolledNumber or something like that?
While signal callbacks can return a value, that returned value won’t be passed back to the signals emitter. So no, that’s no solution for this problem.
how do I get the “return roll” at the bottom of the “roll_a_dice()” signal?
You don’t! If your signal callback returns a value, that value won’t reach the emitter. If you want to do that, don’t use a signal but call the diceroll-function directly.