title: How to get the selected items in VLC using Lua?
body: <p>I am currently extending VLC by creating a Lua extension to remove all selected items in a playlist from the disk as well as the playlist itself.</p>
  <p>Since VLC doesn't have a function to remove them from the disk, i would need to grab all selected items.</p>
  <p>There is an extension called vlc-delete.lua doing so, but it's only for the current playing item, not the selected items in the playlist.</p>
  <p>Also i found a function called <code>[get_selection][1]</code> but i doesn't seems to do what it should do.</p>
  <p>Maybe Lua does not support it, but it's hard to figure that out due a lack of documentation of VLC and Lua.</p>
  <p>My first attempt was trying like that, but list is not defined.</p>
  <pre><code>function activate()
      vlc.msg.info(&quot;[vlc-delete-playlist-selection] removing playlist selection files from disk&quot;)
      selection = list:get_selection()
      if (not selection) then
          vlc.msg.info(&quot;NO SELECTION! ENDING&quot;)
          return 1 
      end
      local sel = nil
      for idx, selectedItem in pairs(selection) do
          vlc.msg.info(&quot;Sel item: &quot; .. selectedItem)
          sel = idx
          break
      end
   
  end
   
  </code></pre>