function(a, b) --> output

70 views
Skip to first unread message

Rett Berg

unread,
Jun 21, 2024, 5:42:06 PM (11 days ago) Jun 21
to lua-l
Something I've started doing is use --> for documenting the output type and description, i.e.

M.plus3 = function(a) --> number: 3 more than a
  return a + 3
end

I can't imagine I'm the only one doing this, but I haven't really seen it in others code. Does anyone else do this?

--> Rett

wfrsk

unread,
Jun 21, 2024, 5:46:56 PM (11 days ago) Jun 21
to lu...@googlegroups.com

I have seen it to create examples of what a statement would print:

```
local t = {}

print(t) --> table: <address>
```

- wfrsk



-------- Original Message --------
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lua-l/5e52b86e-2712-493b-9eda-0ba9c411ae1cn%40googlegroups.com.
publickey - wfrsk@proton.me - 0x94414D16.asc
signature.asc

Lars Müller

unread,
Jun 23, 2024, 12:13:12 PM (10 days ago) Jun 23
to lu...@googlegroups.com

I do this too, though I would write this annotation above the line where I define the function. I also prefer documenting the return value "inline" right where the return statement is with a simple comment.

On 21/06/2024 23:42, Rett Berg wrote:
Reply all
Reply to author
Forward
0 new messages