[vlc-devel] [PATCH 3/5] VLSub: Refactor get_all_sel

Alon Sirota sirotaalon at gmail.com
Sun Sep 6 09:39:33 CEST 2020


Remove redundent local variable 'i' that was used as a counter when
iterating over table, use indexes[#indexes + 1] instead.
---
 share/lua/extensions/VLSub.lua | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/share/lua/extensions/VLSub.lua b/share/lua/extensions/VLSub.lua
index 4444ece..bb7849c 100644
--- a/share/lua/extensions/VLSub.lua
+++ b/share/lua/extensions/VLSub.lua
@@ -1432,10 +1432,8 @@ end
 function get_all_sel(list)
   local selection = list:get_selection()
   local indexes = {}
-  local i = 1 -- key counter
   for index, name in pairs(selection) do
-    indexes[i] = index
-    i = i + 1
+    indexes[#indexes + 1] = index
   end
   return indexes
 end
-- 
2.28.0



More information about the vlc-devel mailing list