Board index FlightGear Development Nasal

Un-documented parameter for getnode() ?  Topic is solved

Nasal is the scripting language of FlightGear.

Un-documented parameter for getnode() ?

Postby skipper0802 » Thu Aug 23, 2018 3:43 pm

Hello All,
I'm working with the PC-9M/lights.nas file and noted this line:
Code: Select all
beacon_switch = props.globals.getNode("controls/switches/beacon", 2);


I found the getnode() definition here: http://wiki.flightgear.org/Nasal_library/props#getNode.28.29
getNode()
props.Node.getNode(rel_path[, create]);
Returns a subnode as another props.Node instance.
rel_path
Relative path to the subnode as a string.
create
If 1 (true), the node will be created if it does not exist. If 0 (false) and the node does not exist, the function will return nil. Default to 0 (false).


What does the parameter "2" provide?
Thanks in advance,

Eric
V/r,
Eric
*******************************************************************
Intel Core i7-3520M CPU @ 2.9GHz, 16 GB RAM, 64-bit OS, x64-based processor
HP EliteBook 8770W
AMD FirePro M4000 1GB
Windows 10 Home
Flightgear 2018.2.2
skipper0802
 
Posts: 24
Joined: Tue Apr 24, 2018 3:12 pm
Location: Seattle, Washington, USA
Callsign: 0802SK, skipper0802
Version: 2018.2.2
OS: Windows10 Home

Re: Un-documented parameter for getnode() ?

Postby Necolatis » Sat Aug 25, 2018 12:56 am

This function in nasal is just a wrapper for C++ code.

I just looked at the code in C++:

0 = false
1 = true
everything else is same as 1

So 2 is same as 1 if I read the code correct. :)
"Airplane travel is nature's way of making you look like your passport photo."
— Al Gore
User avatar
Necolatis
 
Posts: 2032
Joined: Mon Oct 29, 2012 12:40 am
Location: EKOD
Callsign: Leto
IRC name: Neco
Version: 2019.1.2
OS: Windows 10

Re: Un-documented parameter for getnode() ?  

Postby skipper0802 » Sat Aug 25, 2018 5:11 am

Thank you Necolatis for your response. I appreciate it.
V/r,
Eric
*******************************************************************
Intel Core i7-3520M CPU @ 2.9GHz, 16 GB RAM, 64-bit OS, x64-based processor
HP EliteBook 8770W
AMD FirePro M4000 1GB
Windows 10 Home
Flightgear 2018.2.2
skipper0802
 
Posts: 24
Joined: Tue Apr 24, 2018 3:12 pm
Location: Seattle, Washington, USA
Callsign: 0802SK, skipper0802
Version: 2018.2.2
OS: Windows10 Home


Return to Nasal

Who is online

Users browsing this forum: No registered users and 0 guests