예제 #1
0
_MEMBER_FUNCTION_IMPL(xml, findNode)
{
    // Get the XML instance pointer
    CXML * pXML = sq_getinstance< CXML* >( pVM );

    // Is the xml instance valid?
    if( pXML )
    {
        // Get the XML node pointer
        CXMLNode * pNode = sq_getpointer< CXMLNode* >( pVM, 2 );

        // Is the node valid?
        if( pNode )
        {
            // Get the node name
            const char * szName;
            sq_getstring( pVM, 3, &szName );

            // Find the node
            CXMLNode * pFoundNode = pNode->FindNode( szName );

            // Did we find the node?
            if( pFoundNode )
            {
                // Push the found node instance
                sq_pushpointer< CXMLNode* >( pVM, pFoundNode );
                return 1;
            }
        }
    }

    sq_pushbool( pVM, false );
    return 1;
}