-
December 24th, 2013, 11:41 #1
- Join Date
- Nov 2011
- Posts
- 56
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
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
Is something wrong in the code or is there a bug in the copyNode-function?
Regards,
Lule
-
December 24th, 2013, 17:55 #2
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!
-
December 24th, 2013, 21:56 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,538
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
-
January 10th, 2014, 12:32 #4
- Join Date
- Nov 2011
- Posts
- 56
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,
LuleLast edited by lule; January 10th, 2014 at 13:01.
-
January 10th, 2014, 21:28 #5
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,538
Just pushed a new update to the Test version (v3.0.2) that addresses this issue.
JPG
-
January 11th, 2014, 09:19 #6
- Join Date
- Nov 2011
- Posts
- 56
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