moonscript icon indicating copy to clipboard operation
moonscript copied to clipboard

self documenting function

Open sucrecacao opened this issue 4 years ago • 1 comments

Hello

I'm just discovering moonscript and it's a beautiful language ! big big kuddos !

I'm looking at a way to self document my function in moonscript so I can have something similar to python:

f = (x) ->  x + 5
f.doc = 'add five to a number'
help(f) -- print 'add five to a number'

sucrecacao avatar Jan 06 '21 16:01 sucrecacao

The language doesn't manage this itself (Lua doesn't either), but you can use a tool like LDoc to generate a documentation page for you: https://github.com/lunarmodules/LDoc

daelvn avatar Jan 07 '21 00:01 daelvn