aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Gadola <giusgadola@gmail.com>2023-02-19 18:45:20 +0100
committerGiuseppe Gadola <giusgadola@gmail.com>2023-02-19 18:45:20 +0100
commitddc1d05e72e0a7cd8474e18ec6883289e02480e7 (patch)
treea6f712e961dd8a61dccefbd44a6410167fb0c09b
parentfix: spaces overflow - merge pull request #13 from matthewsia98/@@@ (diff)
refactor: using vim.tbl_contains instead of utils.table_includes
-rw-r--r--lua/pets/animations.lua2
-rw-r--r--lua/pets/utils.lua9
2 files changed, 1 insertions, 10 deletions
diff --git a/lua/pets/animations.lua b/lua/pets/animations.lua
index d8749c7..a330cec 100644
--- a/lua/pets/animations.lua
+++ b/lua/pets/animations.lua
@@ -150,7 +150,7 @@ function M.Animation:set_next_action()
}
if self.state.sleeping then
-- If the animation isn't currently a sleeping animtion, put the pet in it, otherwise loop the animation
- if not utils.table_includes(sleeping_animations, self.current_action) then
+ if not vim.tbl_contains(sleeping_animations, self.current_action) then
self.current_action = get_sleeping_animation()
end
else
diff --git a/lua/pets/utils.lua b/lua/pets/utils.lua
index 366de2a..dbf1191 100644
--- a/lua/pets/utils.lua
+++ b/lua/pets/utils.lua
@@ -88,13 +88,4 @@ function M.parse_popup_hl(highlight)
)
end
-function M.table_includes(table, key)
- for _, value in ipairs(table) do
- if value == key then
- return true
- end
- end
- return false
-end
-
return M