code: func (l *State) SetTop(index int) {
  	f := l.callInfo.function
  	if index >= 0 {
  		if apiCheck && index > l.stackLast-(f+1) {
  			panic("new top too large")
  		}
  		i := l.top
  		for l.top = f + 1 + index; i < l.top; i++ {
  			l.stack[i] = nil
  		}
  	} else {
  		if apiCheck && -(index+1) > l.top-(f+1) {
  			panic("invalid new top")
  		}
  		l.top += index + 1 // 'subtract' index (index is negative)
  	}
  }
docs: // SetTop accepts any index, or 0, and sets the stack top to index. If the
  // new top is larger than the old one, then the new elements are filled with
  // nil. If index is 0, then all stack elements are removed.
  //
  // If index is negative, the stack will be decremented by that much. If
  // the decrement is larger than the stack, SetTop will panic().
  //
  // http://www.lua.org/manual/5.2/manual.html#lua_settop