Class where you pass in a table #1832
-
Beta Was this translation helpful? Give feedback.
Answered by
carsakiller
Jan 18, 2023
Replies: 1 comment
-
|
You can document the ---@class animal
local animal = {}
animal.__index = animal
---@param settings {x: integer, y: integer}
function animal.new(settings)
local instance = setmetatable({}, animal)
instance.x = settings.x or 0
instance.y = settings.y or 0
return instance
end |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Immow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

You can document the
newfunction like this: