modules/settings.js
// Creates a list of entries in the Compendium (name and _id)
Creates a list of entries in the Compendium (name and _id)
Creates a list of entries in the Compendium ( name and _id )
function compendiumList(compendiumName) {
  let dataPack = game.packs.get(compendiumName);
  let dataList = [];
  if (!dataPack) return dataList;
  dataPack.getIndex().then(function(){
  for (let i = 0; i < dataPack.index.length; i++) {
    const entry = dataPack.index[i];
    if(entry)
      dataList[i] = {
        _id: entry._id,
        name: entry.name
      };   
    }
  });
  return dataList;
}
function compendiumList ( compendiumName ) { let dataPack = game . packs . get ( compendiumName ) ; let dataList = [ ] ; if ( ! dataPack ) return dataList ; dataPack . getIndex ( ) . then ( function ( ) { for ( let i = 0 ; i < dataPack . index . length ; i ++ ) { const entry = dataPack . index [ i ] ; if ( entry ) dataList [ i ] = { _id : entry . _id , name : entry . name } ; } } ) ; return dataList ; }
Creates a list of entries in the Compendium (name and _id)
Creates a list of entries in the Compendium ( name and _id )