H = IxIxR
Where H is the amount of heat produced when a current of I is flown through a conductor of resistance R.
The resistance of human body may be as high as 100,000 ohms. An average bolt produces current of 30kA. If a typical lightning were to pass completely through a human body (even though this is not the case), the heat energy liberated will be 9X10^14 J which is HUGE. The human body is mostly made of protein, with water, fats, and nucleic acids for the most part. Protein coagulates and water evaporates as the temperature rises, and if it is too high the whole thing oxidises, and what will be left will unoxidisable ash and unburnt carbon.
In short, yes it is the heat injury in lightning. But in electrocution, there can be other causes such as cardiac arrhythmia, because the amount of voltage need not necessarily be high enough to oxidise everything up.