vec(...): ud

Overview

The vec function is one of two ways to create a new userdata from scratch, with the other being the userdata function. Produces a new f64 typed 1D userdata populated with each of the arguments.

Arguments

...: number|nil

Each value to populate the userdata with. The number of arguments dictates the width of the produced userdata. Defaults to 0.

Returns

ud: userdata|nil

The userdata produced, or nil if no arguments were provided.

Example

local position = vec(12, 19)

?position:get(0) -- 12
?position:get(1) -- 19