Vector.create: Difference between revisions
From GiderosMobile
Created page with "__NOTOC__ '''Available since:''' Gideros 2026.1<br/> '''Class:''' vector library<br/> === Description === Creates a new vector with the given component values. <syntaxhig..." |
No edit summary |
||
| Line 6: | Line 6: | ||
Creates a new vector with the given component values. | Creates a new vector with the given component values. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
( | (vector) = vector.create(x,y[,z]) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 17: | Line 17: | ||
=== Return values === | === Return values === | ||
'''Returns''' ( | '''Returns''' (vector) the new vector<br/> | ||
=== Example === | === Example === | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local vec = vector.create(1, 2, 3) | local vec : vector = vector.create(1, 2, 3) | ||
print(vec) -- 1, 2, 3 | print(vec) -- 1, 2, 3 | ||
local vec2 = vector.create(1, 2) | local vec2 : vector = vector.create(1, 2) | ||
print(vec2) -- 1, 2, 0 | print(vec2) -- 1, 2, 0 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{vector}} | {{vector}} | ||
Latest revision as of 13:44, 1 February 2026
Available since: Gideros 2026.1
Class: vector library
Description
Creates a new vector with the given component values.
(vector) = vector.create(x,y[,z])
The third (z) component is set to 0 if it is not defined.
Parameters
x: (number) the x component value
y: (number) the y component value
z: (number) the z component value optional
Return values
Returns (vector) the new vector
Example
local vec : vector = vector.create(1, 2, 3)
print(vec) -- 1, 2, 3
local vec2 : vector = vector.create(1, 2)
print(vec2) -- 1, 2, 0