Forgot to implment the Node.getChild(name, index) form of the function
This commit is contained in:
parent
c09aeb9bef
commit
2166dd70a8
1 changed files with 7 additions and 1 deletions
|
@ -152,7 +152,13 @@ static naRef f_getChild(naContext c, naRef args)
|
||||||
NODEARG();
|
NODEARG();
|
||||||
naRef child = naVec_get(args, 0);
|
naRef child = naVec_get(args, 0);
|
||||||
if(!naIsString(child)) return naNil();
|
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();
|
if(!n) return naNil();
|
||||||
return propNodeGhostCreate(c, n);
|
return propNodeGhostCreate(c, n);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue