Writing for Seventeen, Lovato said that she had entered a clinic after struggling with the "life-long disease" but was coping better thanks to the treatment she had received.
The 18-year-old Sonny With A Chance star wrote: "I wish I could tell every young girl with an eating disorder, or who has harmed herself in any way, that she's worthy of life and that her life has meaning. You can overcome and get through anything.
"Yes, there have been times when I definitely have been tempted to get rid of my dinner. But I will deal with it for the rest of my life because it's a life-long disease. I don't think there's going to be a day when I don't think about food or my body, but I'm living with it, and I wish I could tell young girls to find their safe place and stay with it."
Lovato encouraged others in a similar situation to seek help, saying: "If you are going through that dark period, go to your family and closest friends. Don't put yourself in danger. It's very crucial that you get your feelings out - but don't ever inflict harm on your own body because your body is so sacred.
"I don't let anyone's insecurities, emotions, or opinions bother me. I know that if I am happy, that's all that matters to me. And it's okay to be selfish like that sometimes, when it comes to your well-being. Do what makes you happy, and don't care what others think."
Lovato recently announced her return to work, saying that she is "so excited" on Twitter.