FG Spreadshirt Swag
  1. #1

    Bug in copyNode-function or whats wrong with the code?

    Hello FG-Users,

    I have some troubles with a part of the code in the VersionManager.

    Here is the code:

    Code:
    local talentknoten = DB.findNode(charknoten..".skilllist");
    	Debug.console("charknoten", charknoten);
    	Debug.console("talentknoten", talentknoten);
    	if talentknoten then
    		for v,k in pairs(talentknoten.getChildren()) do
    			--[[Lule: v = name of the node, k = node itself]]
    			Debug.console("v", v);
    			Debug.console("k", k);
    			if v == "kampf" then
    				for a,s in pairs(k.getChildren()) do
    					Debug.console("a", a);
    					Debug.console("s", s);
    					
    					pruefknoten = s.getChild("at");
    					if pruefknoten then
    						DB.copyNode(charknoten .. ".skilllist." .. v .. "." .. a .. ".at", charknoten .. ".skilllist." .. v .. "." .. a .. ".attackeTalentwert");
    						pruefknoten.delete();
    					end
    And here the Log of the console:

    Code:
    Runtime Notice: s'charknoten' | s'charsheet.id-00001'
    Runtime Notice: s'talentknoten' | databasenode = { charsheet.id-00001.skilllist }
    Runtime Notice: s'v' | s'kampf'
    Runtime Notice: s'k' | databasenode = { charsheet.id-00001.skilllist.kampf }
    Runtime Notice: s'a' | s'id-00002'
    Runtime Notice: s's' | databasenode = { charsheet.id-00001.skilllist.kampf.id-00002 }
    Script Error: [string "scripts/manager_version.lua"]:811: copyNode: Destination node can not be the same as or a child of the source node
    They are not the same node, as they end differently ".at" vs. ".attackeTalentwert" and they are not a child of each other. Or am I logically wrong here?

    Is something wrong in the code or is there a bug in the copyNode-function?

    Regards,
    Lule

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,402
    Have you tried using a different databasenode variable to charknoten for the target node? It may be that the error handler is seeing the same databasenode variable and raising the error on that, not off the final target node. This would still be a bug, but using a different databasenode may be a work around (just use targetnode = charknoten for the new target node)??
    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!

  3. #3
    Just guessing since I am traveling right now. I think the "parent" check might be a simple substring check, which would technically be a bug.

    Regards,
    JPG

  4. #4
    Thanks for the reply.

    I did some testing (version 3.0.1 and 3.0.2).

    The problem only occurs when the first letters of the destnode name (last node) are identical with the whole sourcenode name (last node). Examples:

    sourcenode name -> destnode name

    problems:
    at -> attack
    na -> name
    name -> nameChar
    label -> labelcycler

    no problems:
    at -> another
    na -> notavailable
    name -> noname
    label -> leftlabel
    name -> namable

    [edit]
    1. With FG version 2.9.4 there are no errors with the code. Tested via Dev-version.
    2. I think, but this is not tested, there is no error, when the destnode is different from the sourcenode before the last node.
    [/edit]

    I hope this is helpful.

    Regards,
    Lule
    Last edited by lule; January 10th, 2014 at 13:01.

  5. #5
    Just pushed a new update to the Test version (v3.0.2) that addresses this issue.

    JPG

  6. #6
    Thanks a lot JPG! With version 3.0.2 there are no more errors.

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