Skip to content

Commit 1a4431c

Browse files
committed
Use buildSyntaxString for Vectors syntax
1 parent 3d17cf2 commit 1a4431c

File tree

6 files changed

+307
-140
lines changed

6 files changed

+307
-140
lines changed

elements/Vector/Vector2.yaml

Lines changed: 85 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,103 +5,143 @@ oop_only_methods:
55
- name: create
66
description: |
77
Default constructor for the Vector2 class. Returns a Vector2 object.
8-
signature: Vector2(mixed vectorOrX[, float y])
98
parameters:
109
- name: vectorOrX
11-
type: float | table | vector2
12-
description: Vector2, table, or float indicating vector's coordinates
10+
type: float | table | Vector2
11+
description: Vector2, table, or float indicating vector's coordinates.
1312
- name: "y"
1413
type: float
15-
optional: true
16-
description: If vectorOrX is a float, this is the Y coordinate
14+
default: 0
15+
description: If vectorOrX is a float, this is the Y coordinate.
16+
returns:
17+
description: Returns **Vector2** element.
18+
values:
19+
- type: Vector2
20+
name: vector
1721

1822
- name: normalize
19-
description: Normalizes the vector
20-
signature: bool Vector2.normalize(vector2 vector)
23+
description: Normalizes the vector.
2124
parameters:
2225
- name: vector
23-
type: vector2
24-
description: Vector2 to normalize
26+
type: Vector2
27+
description: Vector2 to normalize.
28+
returns:
29+
values:
30+
- type: bool
31+
name: result
32+
description: Whether the operation succeeded (e.g., the vector was not zero-length).
2533

2634
- name: getX
27-
description: Gets the X coordinate of a vector
28-
signature: float Vector2.getX(vector2 vector)
35+
description: Gets the X coordinate of a vector.
2936
variable: x
3037
parameters:
3138
- name: vector
32-
type: vector2
33-
description: Vector2 to get X coordinate from
39+
type: Vector2
40+
description: Vector2 to get X coordinate from.
41+
returns:
42+
values:
43+
- type: float|false
44+
name: x
45+
description: The X coordinate.
3446

3547
- name: setX
36-
description: Sets the X coordinate of a vector
37-
signature: bool Vector2.setX(vector2 vector, float x)
48+
description: Sets the X coordinate of a vector.
3849
variable: x
50+
returns:
51+
values:
52+
- type: bool
53+
name: result
54+
description: ''
3955
parameters:
4056
- name: vector
41-
type: vector2
42-
description: Vector2 to set X coordinate on
57+
type: Vector2
58+
description: Vector2 to set X coordinate on.
4359
- name: x
4460
type: float
45-
description: New X coordinate
61+
description: New X coordinate.
4662

4763
- name: getY
48-
description: Gets the Y coordinate of a vector
49-
signature: float Vector2.getY(vector2 vector)
64+
description: Gets the Y coordinate of a vector.
5065
variable: "y"
5166
parameters:
5267
- name: vector
53-
type: vector2
54-
description: Vector2 to get Y coordinate from
68+
type: Vector2
69+
description: Vector2 to get Y coordinate from.
70+
returns:
71+
values:
72+
- type: float|false
73+
name: 'y'
74+
description: The Y coordinate.
5575

5676
- name: setY
57-
description: Sets the Y coordinate of a vector
58-
signature: bool Vector2.setY(vector2 vector, float y)
77+
description: Sets the Y coordinate of a vector.
5978
variable: "y"
79+
returns:
80+
values:
81+
- type: bool
82+
name: result
83+
description: ''
6084
parameters:
6185
- name: vector
62-
type: vector2
63-
description: Vector2 to set Y coordinate on
86+
type: Vector2
87+
description: Vector2 to set Y coordinate on.
6488
- name: "y"
6589
type: float
66-
description: New Y coordinate
90+
description: New Y coordinate.
6791

6892
- name: getNormalized
69-
description: Gets a normalized version of the vector
70-
signature: vector2 Vector2.getNormalized(vector2 vector)
93+
description: Gets a normalized version of the vector.
7194
variable: normalized
7295
parameters:
7396
- name: vector
74-
type: vector2
75-
description: Vector2 to get normalized version of
97+
type: Vector2
98+
description: Vector2 to get normalized version of.
99+
returns:
100+
values:
101+
- type: Vector2|false
102+
name: normalized vector
103+
description: A new normalized vector.
76104

77105
- name: getLength
78-
description: Gets the length of a vector
79-
signature: float Vector2.getLength(vector2 vector)
106+
description: Gets the length of a vector.
80107
variable: length
81108
parameters:
82109
- name: vector
83-
type: vector2
84-
description: Vector2 to get length from
110+
type: Vector2
111+
description: Vector2 to get length from.
112+
returns:
113+
values:
114+
- type: float|false
115+
name: length
116+
description: The vector's length.
85117

86118
- name: getSquaredLength
87-
description: Gets the squared length of a vector
88-
signature: float Vector2.getSquaredLength(vector2 vector)
119+
description: Gets the squared length of a vector.
89120
variable: squaredLength
90121
parameters:
91122
- name: vector
92-
type: vector2
93-
description: Vector2 to get squared length from
123+
type: Vector2
124+
description: Vector2 to get squared length from.
125+
returns:
126+
values:
127+
- type: float|false
128+
name: squaredLength
129+
description: The squared length of the vector.
94130

95131
- name: dot
96-
description: Gets the dot product of two vectors
97-
signature: float Vector2.dot(vector2 vectorOne, vector2 vectorTwo)
132+
description: Gets the dot product of two vectors.
98133
parameters:
99134
- name: vectorOne
100-
type: vector2
101-
description: First vector
135+
type: Vector2
136+
description: First vector.
102137
- name: vectorTwo
103-
type: vector2
104-
description: Second vector
138+
type: Vector2
139+
description: Second vector.
140+
returns:
141+
values:
142+
- type: float|false
143+
name: dot-product
144+
description: The scalar dot product.
105145

106146
examples:
107147
- path: examples/vector2-1.lua

0 commit comments

Comments
 (0)