Annotating the Lua source - snaptoken/lua-tutorial GitHub Wiki
To annotate a Lua source file, read through the code very closely (maybe skim it first) and write inline comments explaining everything that doesn't seem obvious about the code. Be very verbose. Explain EVERYTHING that a reader of the code might be wondering about. If unable to explain something fully, annotate that part with a question, to be researched and answered later. Ask lots of questions, don't take the time to research every little thing.
Especially point out how each function/component fits into the larger picture. For each function/component, say what it is used for and where it is used. (Many functions and data structures are only used in one or two places.)
Annotation comments should be C++-style //
comments, to distinguish them from the C-style /* */
comments that are already there.