]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scripting/nasal-props.cxx
Round millibars to nearest whole number, and make inches default even in UK until...
[flightgear.git] / src / Scripting / nasal-props.cxx
index 1237171b7efc8cd16145b8d678cbba633478b379..1a16f8f918b4c64e31b1277594cbebd844e4a2d5 100644 (file)
@@ -152,7 +152,13 @@ static naRef f_getChild(naContext c, naRef args)
     NODEARG();
     naRef child = naVec_get(args, 0);
     if(!naIsString(child)) return naNil();
-    SGPropertyNode* n = (*node)->getChild(naStr_data(child));
+    naRef idx = naNumValue(naVec_get(args, 1));
+    SGPropertyNode* n;
+    if(naIsNil(idx) || !naIsNum(idx)) {
+        n = (*node)->getChild(naStr_data(child));
+    } else {
+        n = (*node)->getChild(naStr_data(child), (int)idx.num);
+    }
     if(!n) return naNil();
     return propNodeGhostCreate(c, n);
 }