Added lua-language-server annotations
This commit is contained in:
parent
178043bac3
commit
c7d8fa4f8b
7 changed files with 151 additions and 87 deletions
17
point.lua
17
point.lua
|
@ -1,11 +1,15 @@
|
|||
-- Point table
|
||||
Point = {}
|
||||
-- Represents 2D point
|
||||
---@class Point
|
||||
Point = { x = 1, y = 1 }
|
||||
|
||||
-- Factory function
|
||||
-- Point factory
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@return any
|
||||
function Point:new( x, y )
|
||||
local point = {
|
||||
x = x or 1,
|
||||
y = y or 1
|
||||
x = x or x,
|
||||
y = y or y
|
||||
}
|
||||
|
||||
setmetatable( point, { __index = self } )
|
||||
|
@ -14,11 +18,14 @@ function Point:new( x, y )
|
|||
end
|
||||
|
||||
-- Comparing function
|
||||
---@param point self
|
||||
---@return boolean
|
||||
function Point:equals( point )
|
||||
return self.x == point.x and self.y == point.y
|
||||
end
|
||||
|
||||
-- Get self coordinates
|
||||
---@return number, number
|
||||
function Point:coords()
|
||||
return self.x, self.y
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue