From: andy Date: Mon, 29 Dec 2003 22:52:21 +0000 (+0000) Subject: Forgot to implment the Node.getChild(name, index) form of the function X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2166dd70a8dbd4a84c087771cc14a6ecfd915925;p=flightgear.git Forgot to implment the Node.getChild(name, index) form of the function --- diff --git a/src/Scripting/nasal-props.cxx b/src/Scripting/nasal-props.cxx index 1237171b7..1a16f8f91 100644 --- a/src/Scripting/nasal-props.cxx +++ b/src/Scripting/nasal-props.cxx @@ -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); }