Rework lua document tool.

- Allow @method and @function
- Convert from unordered hash tables to arrays
- Consider perl style guide
More style improvements.
Update regexp documentation.