MCPcopy
hub / github.com/g3n/engine / RemoveAt

Method RemoveAt

core/node.go:433–450  ·  view source on GitHub ↗

RemoveAt removes the child at the specified index.

(idx int)

Source from the content-addressed store, hash-verified

431
432// RemoveAt removes the child at the specified index.
433func (n *Node) RemoveAt(idx int) INode {
434
435 // Validate position
436 if idx < 0 || idx >= len(n.children) {
437 panic("Node.RemoveAt: invalid position")
438 }
439
440 child := n.children[idx]
441
442 // Remove child from children list
443 copy(n.children[idx:], n.children[idx+1:])
444 n.children[len(n.children)-1] = nil
445 n.children = n.children[:len(n.children)-1]
446
447 n.Dispatch(OnDescendant, nil)
448
449 return child
450}
451
452// RemoveAll removes all children.
453func (n *Node) RemoveAll(recurs bool) {

Callers

nothing calls this directly

Calls 1

DispatchMethod · 0.65

Tested by

no test coverage detected