Documenting my code

Well, LDoc has the @field annotation that you can use, but it also tries to infer table documentation. Check the manual and scroll down to “Table and Constant values”. The explicit form would be:

--- a useful table of constants
-- @field alpha first correction
-- @field beta second correction
-- @field gamma fudge factor
-- @table constants

While the inferred form would be:

--- a useful table of constants
M.constants = {
    alpha = 0.23, -- first correction
    beta = 0.443, -- second correction
    gamma = 0.01  -- fudge factor
}

At King we use our own unit testing framework, but for my own stuff I’ve used Telescope. I even made a forum post about unit testing and I created a repo with Telescope and some additional wrapper code to simplify testing of async stuff.