MediaWiki has been updated to version 1.35.1. Please report any problems here.

Talk:Nasal and the Property-tree

From FlightGear wiki
Jump to navigation Jump to search

this is great, but do note that there's a python script written by Adrian that extracts this sort of info automatically from $FG_ROOT/Nasal --Hooray (talk) 20:08, 8 February 2014 (UTC)

Yes, I remember now last spring you told me that for another page I made. But most of this info did not come from the Nasal comments, but from Doxygen, I simply could not find what all those methods did except from some scattered bits in the forums, there is no comments for most of them, so when I found the old Doxygen generated page even though it was a bit dated, I thought I would help others who would spend long time figuring out what they all did. Necolatis (talk) 06:25, 9 February 2014 (UTC)

Wrong props.Node.getNode() signature

The signature getNode(relative_path, index=0, create = false) is wrong. It seems the correct signature is similar to that of getprop().

n.getNode("a", 1, 1) does not create any node despite the last '1'.

n.getNode("a", 3, "cc") seems to be equivalent to n.getNode("a[3]/cc").

(tested with FG 2016.1.0 from 2016-01-07)

This unsigned comment was added by Rominet (Talk | contribs) 21:28, January 7, 2016 (UTC)

You are right that it is wrong. But unless it changed in the very latest builds it also does not work like you describes.
The correct signature would be: getNode(relative_path, create = false)
Just try open FG and open the Nasal console, and type in: props.globals.getNode("a",1); and hit execute, you will clearly see in the property browser that a new property called 'a' will appear in the root.
I will update the page.
--Necolatis (talk) 18:56, 7 January 2016 (EST)
I agree with you. I was a bit confused because the Nasal console is hardly readable for me and I didn't realize yesterday that my test code had a mixture of getNode() and getChild() calls. I can also confirm that there is no polymorphism by looking at fgdata/Nasal/props.nas (line 13) and flightgear/src/Scripting/nasal-props.cxx (line 636)... and another test. :-)
Thank you for updating the page. I think you may delete this discussion once you have read it. Good luck, special agent Necolatis. ;-)
(BTW, is there something special to do to insert a signature as you do?)
This unsigned comment was added by Rominet (Talk | contribs) 09:11, January 8, 2016‎ (UTC)
In the editor at the top there is a little icon with a blue pen, writing. Click on that to insert signs that will become signature.
--Necolatis (talk) 08:24, 8 January 2016 (EST)
Ah, good to know, thank you. :-)
--Rominet (talk) 09:28, 8 January 2016 (EST)