aboutsummaryrefslogtreecommitdiff
path: root/lua/pets/pet.lua
diff options
context:
space:
mode:
authorGiuseppe Gadola <giusgadola@gmail.com>2023-02-11 21:57:50 +0100
committerGiuseppe Gadola <giusgadola@gmail.com>2023-02-11 21:57:50 +0100
commitfae2404050f45990c8e4180f1f565af1311c46d0 (patch)
tree5372c9d5b40dd1e9ea267947f66f908a02072fc9 /lua/pets/pet.lua
parentrefactor(options): options are passed directly as a table (diff)
docs: added some function explanations and comments
Diffstat (limited to 'lua/pets/pet.lua')
-rw-r--r--lua/pets/pet.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/lua/pets/pet.lua b/lua/pets/pet.lua
index 1b1249e..6a31ff2 100644
--- a/lua/pets/pet.lua
+++ b/lua/pets/pet.lua
@@ -18,9 +18,11 @@ local popup_opts = {
winblend = 100,
},
}
+
-- @param name the actual name for the pet
-- @param type the species of the pet e.g. cat
-- @param style the color/style of the pet e.g. brown
+-- @param user_opts the table with user options (to be passed to Animation)
-- @return a new Pet instance
function M.Pet.new(name, type, style, user_opts)
local instance = setmetatable({}, M.Pet)
@@ -42,11 +44,13 @@ function M.Pet.new(name, type, style, user_opts)
return instance
end
+-- start the animation of the pet
function M.Pet:animate()
self.popup:mount()
self.animation:start(self.popup.bufnr)
end
+-- delete the pet :(
function M.Pet:kill()
self.popup:unmount()
self.animation:stop()