From ddc1d05e72e0a7cd8474e18ec6883289e02480e7 Mon Sep 17 00:00:00 2001 From: Giuseppe Gadola Date: Sun, 19 Feb 2023 18:45:20 +0100 Subject: refactor: using vim.tbl_contains instead of utils.table_includes --- lua/pets/animations.lua | 2 +- lua/pets/utils.lua | 9 --------- 2 files changed, 1 insertion(+), 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 -- cgit v1.3-2-g11bf