Talk:Nasal and the Property-tree: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
Line 12: Line 12:


(tested with FG 2016.1.0 from 2016-01-07)
(tested with FG 2016.1.0 from 2016-01-07)
: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.
:--[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 18:56, 7 January 2016 (EST)

Revision as of 23:57, 7 January 2016

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)

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)