-1
function newpos(xScale, xOffset, yScale, yOFfset)
    print(f.Position)
end

local f = {}
f.Position = 1
f.Size = newpos(1, 0, 1, 0)
f.Filled = true
f.Visible = true

我如何从 newpos 获取 f 表?

4

1 回答 1

0

我如何从 newpos 获取 f 表

如果要从函数中获取表,则该函数需要返回该表。

假设您要创建一个表示 2d 点的表:

function newpos(x, y)
  local p = {
    x = x,
    y = y,
  }
  return p
end

然后你可以做类似的事情

local origin = newpos(0, 0)
print(origin.x, origin.y)
于 2022-01-03T10:28:41.527 回答