mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-22 23:42:59 +00:00
Vector3: default to 0 for unspecified args
This commit is contained in:
parent
8a14d35c04
commit
40173b2647
1 changed files with 3 additions and 9 deletions
|
@ -8,15 +8,9 @@ Vector3.__index = Vector3
|
||||||
-- @param y number The y co-ordinate value.
|
-- @param y number The y co-ordinate value.
|
||||||
-- @param z number The z co-ordinate value.
|
-- @param z number The z co-ordinate value.
|
||||||
function Vector3.new(x, y, z)
|
function Vector3.new(x, y, z)
|
||||||
if type(x) ~= "number" then
|
x = x or 0
|
||||||
error("Error: Expected number for the value of x, but received argument of type "..type(x)..".")
|
y = y or 0
|
||||||
end
|
z = z or 0
|
||||||
if type(y) ~= "number" then
|
|
||||||
error("Error: Expected number for the value of y, but received argument of type "..type(y)..".")
|
|
||||||
end
|
|
||||||
if type(z) ~= "number" then
|
|
||||||
error("Error: Expected number for the value of z, but received argument of type "..type(z)..".")
|
|
||||||
end
|
|
||||||
|
|
||||||
local result = {
|
local result = {
|
||||||
x = x,
|
x = x,
|
||||||
|
|
Loading…
Reference in a new issue