leafo / moonscript

:crescent_moon: A language that compiles to Lua
https://moonscript.org
3.18k stars 190 forks source link

self documenting function #433

Open sucrecacao opened 3 years ago

sucrecacao commented 3 years ago

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'
daelvn commented 3 years ago

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