As an ex gym goer, "Hoping to join again", I would say the diet is important, but what really burns calories is weight lifting. Don't listen to half the rubbish about cardio. I went to to the gym for 5 years, and had the build of a light weight boxer. I also noticed all the slim toned ripped guys, never did any cardio. I first hand witnessed for years, people walking on the treadmill for hours, and they were still overweight 4 years later! I'm not saying cardio is bad, it's not, but you put a lot of energy in, and burn very little calories compared to weight lifting. Your body carries on burning calories for a couple of hours even after you stop lifting. Running also bad on knees, as you get older. I would say though, that cycling is the better cardio, and that and weight lifting, got me in the best shape of my life at 40. No sweets or alcohol. Curry once a week is fine, as I did all the time I went to the gym! Healthy protein, like steak, omlettes. I practically lived on omlettes!
