5E Product Walkthrough Playlist
  1. #1
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    244

    DB path of a known name

    It will be today's tiredness, but I'm wrapping up on what is probably nonsense.
    I need to go back to the DB path of a skill whose name I know, but I can't.

    Help.
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  2. #2
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    244
    This is my solution. There is a better way?
    Code:
    function getGlobalElementPath(sElementName, sSource)
        if sElementName == "" or sSource == "" then
            return nil;
        end
    
        for _, nodeElement in pairs(DB.getChildrenGlobal(sSource)) do
            if nodeElement.getChild("name").getValue() == sElementName then
                return nodeElement;
            end
        end
    end
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  3. #3
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    That's what you have to do - iterate through the node hierarchy.

    I'd recommend you change nodeElement.getChild("name").getValue() to DB.getValue(nodeElement, "name", "") this is more efficient (less API calls) and it also returns a default of "" if the node doesn't exist - which will help to avoid errors if it doesn't exist.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  4. #4
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    244
    Great! Ty
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in