Skip to content

Vector2int16 ​

Vector2int16 表示由两个 16 位整数构成的二维向量,常用于网格坐标、区块索引或离散位置表示。它提供简洁的 x、y 分量读写,并支持通过 New 方法快速构造实例。

概览 ​

Vector2int16 表示由两个 16 位整数构成的二维向量,常用于网格坐标、区块索引或离散位置表示。它提供简洁的 x、y 分量读写,并支持通过 New 方法快速构造实例。

可通过 Vector2int16.New(x, y) 构造

代码示例 ​

构造 Vector2int16 并读写分量

lua
-- @runtime client
local vec = Vector2int16.New(3, 5)
print(string.format('x=%d y=%d', vec.x, vec.y))

vec.x = vec.x + 1
vec.y = vec.y + 2
print(string.format('updated: x=%d y=%d', vec.x, vec.y))

属性 ​

名称类型默认值说明
xInt-Vector2int16 的 X 分量,整数类型。
yInt-Vector2int16 的 Y 分量,整数类型。