Modding Help A quick world.containerPutItemsAt question

Discussion in 'Starbound Modding' started by MelOzone, Apr 28, 2017.

  1. MelOzone

    MelOzone Pangalactic Porcupine

    Does this function return anything?
    In my case I generate a manually crafted object and I want to make sure I do not get a perfectly generic item (and do stuff if I actually get it). How can I look what my container actually got after running this function?
     
  2. MelOzone

    MelOzone Pangalactic Porcupine

  3. bk3k

    bk3k Oxygen Tank

    It returns an itemDescriptor if it fails to place the item. I don't believe you'd get anything upon success.

    There is also the possibility that it is sending more than one return, one of them being nil. You could assign multiple variables to catch them, or better yet just do this.

    Code:
    local temp = { world.containerItemAt(entity.id(), 0) }
    local itemDes = temp[1]
    
    That would pack all the returns in a table. But it should throw away nil returns.

    itemDes may still be nil after doing this, but that means nothing is in slot 0.
     
    Last edited: Apr 28, 2017
    MelOzone likes this.

Share This Page