Results 1 to 9 of 9

Thread: Discussion On GetItemComponents()

  1. #1
    Basic Member
    Join Date
    Dec 2016
    Posts
    164

    Lightbulb Discussion On GetItemComponents()

    I think there is sth strange in GetItemComponents( sItemName )

    i try this code for ring of aquila
    Code:
    _name = "item_ring_of_aquila"
    local hl = GetItemComponents( _name );
    local da= hl[1]
    print( table.getn( hl ) );
    print( table.getn( da ) );
    print( da );
    the result is:
    Code:
    1
    2
    item_wraith_band
    the only possible structure of hl here is {{ item_wraith_band , the_ring_of_sth }}. here why GetItemComponents() return table with size 1 and inner table contain lower level subitems. what i mean, is there any idea behind this nested table structure? any comments?

    @ChrisC need your help.

    Thanks

  2. #2

  3. #3
    Basic Member
    Join Date
    Dec 2016
    Posts
    164
    Quote Originally Posted by nostrademous View Post
    yes u are right, GetItem... returns extra table. but why this happen?

    maybe API wants to return table like this
    {{ ... ,... ,... },{...,...}}
    first table is the components of wraith band and second one is for ring of basilius.

  4. #4
    I like the current format (except the extra rapper). On the other hand, the extra rapper might be useful if Chris wants to add more info to the output (like GetItemComponents(X)["HasComponents"]).

  5. #5
    Basic Member
    Join Date
    Dec 2016
    Posts
    164
    yes also this format would help developers to find where we can but all items once together( Base, Secret or side )
    NOTE: I create this format manually

  6. #6
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,698
    The extra wrapper is there because sometimes there are multiple recipes that can build into an item -- like Power Treads. It would return:

    { { item_boots, item_gloves, item_belt_of_strength }, { item_boots, item_gloves, item_robe }, { item_boots, item_gloves, item_boots_of_elves } }

  7. #7
    Basic Member
    Join Date
    Dec 2016
    Posts
    643
    Quote Originally Posted by ChrisC View Post
    The extra wrapper is there because sometimes there are multiple recipes that can build into an item -- like Power Treads. It would return:

    { { item_boots, item_gloves, item_belt_of_strength }, { item_boots, item_gloves, item_robe }, { item_boots, item_gloves, item_boots_of_elves } }
    Noted, thank you.

  8. #8
    Quote Originally Posted by ChrisC View Post
    The extra wrapper is there because sometimes there are multiple recipes that can build into an item -- like Power Treads. It would return:

    { { item_boots, item_gloves, item_belt_of_strength }, { item_boots, item_gloves, item_robe }, { item_boots, item_gloves, item_boots_of_elves } }
    Good point! I can't think of any other item with this property, which is probably why everyone missed the point! (if I remember correctly, aghs at some point I think was similar)

  9. #9
    Basic Member
    Join Date
    Dec 2016
    Posts
    164
    Quote Originally Posted by ChrisC View Post
    The extra wrapper is there because sometimes there are multiple recipes that can build into an item -- like Power Treads. It would return:

    { { item_boots, item_gloves, item_belt_of_strength }, { item_boots, item_gloves, item_robe }, { item_boots, item_gloves, item_boots_of_elves } }
    Whoa, Thats nice, thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •