-
We can use ---@param n number
function fact(n)
return n == 0 and 1 or n*fact(n-1)
end However, in some functions we may have an ellipsis ( ---@class Tree
---@param x any
---@param ... Tree[]
function Tree:new(x, ...)
local obj = {
value = x,
children = {...},
parent = nil,
depth = 0
}
self.__index = self
return setmetatable(obj, self) However, addressing I've tried I was wondering if there was a way to cover my use case, and if not, to propose using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Don't you read the documentation? "
|
Beta Was this translation helpful? Give feedback.
Don't you read the documentation? "
...
" is called vararg:@vararg
Indicates a function has multiple variable arguments.
For returning a vararg you can use
...
as a type.