Getting a list size?

edited October 2012 in Help request
Is it possible to get a list size? For example, if I had a list of strings and wanted to know for a loop how many to iterate over, eg:
[AllMyLists]
MyList = F #T #T #OBR #S #S #R #L #S #S
orxConfig_SelectSection("AllMyLists");  
orxConfig_PushSection("AllMyLists"); 

for (int x=0; x<10; x++){
	const orxSTRING item = orxConfig_GetListString("MyList ", x);
}

I'd like to replace the 10 with a call.

Comments

  • edited October 2012
    orxConfig_GetListCounter("MyList");
    
    :)

    PS: You don't need the orxConfig_SelectSection() as you're pushing it anyway.
  • edited October 2012
    Ah that's perfect thank you. I skipped over that function due to the description:
    orxDLLAPI orxS32 orxFASTCALL orxConfig_GetListCounter ( const orxSTRING _zKey )

    Gets list counter for a given key

    Parameters:
    [in] _zKey Key name

    Returns:
    List counter if it's a valid list, 0 otherwise


    That read to me that it was some kind of counter or iterator rather than a total or list count.

    I'd suggest rewording to something like:
    orxDLLAPI orxS32 orxFASTCALL orxConfig_GetListCounter ( const orxSTRING _zKey )

    Gets a total list count for a given key

    Parameters:
    [in] _zKey Key name

    Returns:
    The total count if it's a valid list, 0 otherwise

    Though it may have been perfectly obvious to others. :)
  • edited October 2012
    Sure, sounds good to me. Want to do the change yourself and create a pull request? :)
  • edited November 2012
    Yep I'll organise that. Once I get hg sorted out. My pull from bit bucket has been a bit of a disaster.
Sign In or Register to comment.