From 2166dd70a8dbd4a84c087771cc14a6ecfd915925 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 29 Dec 2003 22:52:21 +0000 Subject: [PATCH] Forgot to implment the Node.getChild(name, index) form of the function --- src/Scripting/nasal-props.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); } -- 2.39.5