You can prevent yourself from spending too much by bringing a certain amount of money, if you lose then nothing is left and you cant spend further since your money is limited.
Greed is the reason why a gambler is tempted to keep trying even he is losing his money, he want to chase the losses hoping to get it back.
Self discipline is important and dont expect to win, accept if you lose and move on.
I think the point is financial management, if you want to quit while you still have a balance in your gambling account then you will continue to playing.
Use the right amount of money to deposit, so that when your money runs out you will not continue to play again. Yeah discipline is the most important thing, it is a trait that must be possessed by gamblers. Without discipline the plan you make will be useless. and don't forget to know the risk that losses are a natural thing to happen to all gamblers.