Skip to content

Commit 3017212

Browse files
committed
add: description for @operator #599
1 parent a92a800 commit 3017212

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

locale/en-us/script.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,3 +1022,33 @@ print(x) --> table
10221022
---
10231023
[View Wiki](https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Annotations#cast)
10241024
]=]
1025+
LUADOC_DESC_OPERATOR =
1026+
[=[
1027+
Provide type declaration for [operator metamethods](http://lua-users.org/wiki/MetatableEvents).
1028+
1029+
## Syntax
1030+
`@operator <operation>[(input_type)]:<resulting_type>`
1031+
1032+
## Usage
1033+
### Vector Add Metamethod
1034+
```
1035+
---@class Vector
1036+
---@operation add(Vector):Vector
1037+
1038+
vA = Vector.new(1, 2, 3)
1039+
vB = Vector.new(10, 20, 30)
1040+
1041+
vC = vA + vB
1042+
--> Vector
1043+
```
1044+
### Unary Minus
1045+
```
1046+
---@class Passcode
1047+
---@operation unm:integer
1048+
1049+
pA = Passcode.new(1234)
1050+
pB = -pA
1051+
--> integer
1052+
```
1053+
[View Request](https://github.com/sumneko/lua-language-server/issues/599)
1054+
]=]

0 commit comments

Comments
 (0)