This is valid, unless you also have that kind of interest with gambling, your loneliness will lead you to keep playing to forget about something,
but on the other hand, you are developing addiction.
Though there are many other things that you can be involve with, but if you are already have that desire to play it can bring you to keep playing from time to time, making you to resort your loneliness to gambling and add more danger to yourself.
Once addiction dominates you, it will surely harm the balance with your mental and financial capabilities.
It is somewhat ironic that with the massive access people have to technology that allows them to communicate with other people all over the world, more and more people feel alone and they are engaging in behaviors that could make them take a dangerous path, so if anyone is feeling this way what they need to do is to look for company with groups of people that may enjoy their hobbies, and in this way eliminate any possibility of developing an addiction.