code: func UpValueId(l *State, f, n int) interface{} {
  	switch fun := l.indexToValue(f).(type) {
  	case *luaClosure:
  		return *l.upValue(f, n)
  	case *goClosure:
  		return &fun.upValues[n-1]
  	}
  	panic("closure expected")
  }
docs: // UpValueId returns a unique identifier for the upvalue numbered n from the
  // closure at index f. Parameters f and n are as in UpValue (but n cannot be
  // greater than the number of upvalues).
  //
  // These unique identifiers allow a program to check whether different
  // closures share upvalues. Lua closures that share an upvalue (that is, that
  // access a same external local variable) will return identical ids for those
  // upvalue indices.