Make sure ldoc isn't nil. 

"attempt to index local 'ldoc' (a nil value)"

This happened when running ldoc on a random folder of lua files