Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit f28d0f0

Browse files
committed
Fix position module generics not working
1 parent 43b4893 commit f28d0f0

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

position.lua

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ local flib_position = {}
88

99
--- Add two positions.
1010
--- @generic P
11-
--- @param pos1 `P`
12-
--- @param pos2 `P`
11+
--- @param pos1 P
12+
--- @param pos2 P
1313
--- @return P
1414
function flib_position.add(pos1, pos2)
1515
local x1 = pos1.x or pos1[1]
@@ -25,7 +25,7 @@ end
2525

2626
--- Ceil the given position.
2727
--- @generic P
28-
--- @param pos `P`
28+
--- @param pos P
2929
--- @return P
3030
function flib_position.ceil(pos)
3131
if pos.x then
@@ -37,8 +37,8 @@ end
3737

3838
--- Calculate the distance between two positions.
3939
--- @generic P
40-
--- @param pos1 `P`
41-
--- @param pos2 `P`
40+
--- @param pos1 P
41+
--- @param pos2 P
4242
--- @return number
4343
function flib_position.distance(pos1, pos2)
4444
local x1 = pos1.x or pos1[1]
@@ -50,8 +50,8 @@ end
5050

5151
--- Calculate the squared distance between two positions.
5252
--- @generic P
53-
--- @param pos1 `P`
54-
--- @param pos2 `P`
53+
--- @param pos1 P
54+
--- @param pos2 P
5555
--- @return number
5656
function flib_position.distance_squared(pos1, pos2)
5757
local x1 = pos1.x or pos1[1]
@@ -63,8 +63,8 @@ end
6363

6464
--- Divide two positions.
6565
--- @generic P
66-
--- @param pos1 `P`
67-
--- @param pos2 `P`
66+
--- @param pos1 P
67+
--- @param pos2 P
6868
--- @return P
6969
function flib_position.div(pos1, pos2)
7070
local x1 = pos1.x or pos1[1]
@@ -80,7 +80,7 @@ end
8080

8181
--- Return the position in explicit form.
8282
--- @generic P
83-
--- @param pos `P`
83+
--- @param pos P
8484
--- @return P
8585
function flib_position.ensure_explicit(pos)
8686
if pos.x then
@@ -92,7 +92,7 @@ end
9292

9393
--- Return the position in shorthand form.
9494
--- @generic P
95-
--- @param pos `P`
95+
--- @param pos P
9696
--- @return P
9797
function flib_position.ensure_short(pos)
9898
if pos.x then
@@ -104,8 +104,8 @@ end
104104

105105
--- Test if two positions are equal.
106106
--- @generic P
107-
--- @param pos1 `P`
108-
--- @param pos2 `P`
107+
--- @param pos1 P
108+
--- @param pos2 P
109109
--- @return boolean
110110
function flib_position.eq(pos1, pos2)
111111
local x1 = pos1.x or pos1[1]
@@ -117,7 +117,7 @@ end
117117

118118
--- Floor the given position.
119119
--- @generic P
120-
--- @param pos `P`
120+
--- @param pos P
121121
--- @return P
122122
function flib_position.floor(pos)
123123
if pos.x then
@@ -140,8 +140,8 @@ end
140140

141141
--- Test if `pos1` is less than or equal to `pos2`.
142142
--- @generic P
143-
--- @param pos1 `P`
144-
--- @param pos2 `P`
143+
--- @param pos1 P
144+
--- @param pos2 P
145145
--- @return boolean
146146
function flib_position.le(pos1, pos2)
147147
local x1 = pos1.x or pos1[1]
@@ -153,8 +153,8 @@ end
153153

154154
--- Test if `pos1` is less than `pos2`.
155155
--- @generic P
156-
--- @param pos1 `P`
157-
--- @param pos2 `P`
156+
--- @param pos1 P
157+
--- @param pos2 P
158158
--- @return boolean
159159
function flib_position.lt(pos1, pos2)
160160
local x1 = pos1.x or pos1[1]
@@ -166,8 +166,8 @@ end
166166

167167
--- Take the remainder (modulus) of two positions.
168168
--- @generic P
169-
--- @param pos1 `P`
170-
--- @param pos2 `P`
169+
--- @param pos1 P
170+
--- @param pos2 P
171171
--- @return P
172172
function flib_position.mod(pos1, pos2)
173173
local x1 = pos1.x or pos1[1]
@@ -183,8 +183,8 @@ end
183183

184184
--- Multiply two positions.
185185
--- @generic P
186-
--- @param pos1 `P`
187-
--- @param pos2 `P`
186+
--- @param pos1 P
187+
--- @param pos2 P
188188
--- @return P
189189
function flib_position.mul(pos1, pos2)
190190
local x1 = pos1.x or pos1[1]
@@ -200,8 +200,8 @@ end
200200

201201
--- Subtract two positions.
202202
--- @generic P
203-
--- @param pos1 `P`
204-
--- @param pos2 `P`
203+
--- @param pos1 P
204+
--- @param pos2 P
205205
--- @return P
206206
function flib_position.sub(pos1, pos2)
207207
local x1 = pos1.x or pos1[1]
@@ -217,8 +217,8 @@ end
217217

218218
--- Take the power of two positions. `pos1^pos2`.
219219
--- @generic P
220-
--- @param pos1 `P`
221-
--- @param pos2 `P`
220+
--- @param pos1 P
221+
--- @param pos2 P
222222
--- @return P
223223
function flib_position.pow(pos1, pos2)
224224
local x1 = pos1.x or pos1[1]

0 commit comments

Comments
 (0)