Jump to content


Photo

Problem with getting inspect link data

node.js node-steam-tradeoffer-manager inspect object

Best Answer dareq112 , 05 April 2019 - 07:15 PM

Thank you for the answer, now everything works smooth :)

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 dareq112

dareq112

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 04 April 2019 - 09:12 PM

Hello there,

 

got some small problems in fetching item inspect link. I'm getting user inventory through getUserInventoryContents. When i get whole market_actions property it's working fine and giving me result with link and name. But when i try to get link property from market_actions, there's an error popping up  "Cannot read property '0' of undefined".

community.getUserInventoryContents("[U:1:884434522]", 730, 2, true, "polish", (err, inventory) => {
    if (err) {
        throw err;
    }
    for (let i=0; i<inventory.length; i++) {
         console.log(inventory[i].market_actions) // working
         console.log(inventory[i].market_actions[0].link) // not working


#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,111 posts

Posted 05 April 2019 - 04:12 PM

Not every item is going to necessarily have market_actions. You need to check for each item to make sure that market_actions exists and isn't empty.


  • dareq112 likes this

#3 dareq112

dareq112

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 05 April 2019 - 07:15 PM   Best Answer

Thank you for the answer, now everything works smooth :)


Edited by dareq112, 05 April 2019 - 07:28 PM.






Also tagged with one or more of these keywords: node.js, node-steam-tradeoffer-manager, inspect, object

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users