// SetMetaTable pops a table from the stack and sets it as the new metatable
// for the value at index.
//
// http://www.lua.org/manual/5.2/manual.html#lua_setmetatable
544147
func (l *State) SetMetaTable(index int) {
	l.checkElementCount(1)
	mt, ok := l.stack[l.top-1].(*table)
	if apiCheck && !ok && l.stack[l.top-1] != nil {
		panic("table expected")
	}
	switch v := l.indexToValue(index).(type) {
	case *table:
		v.metaTable = mt
	case *userData:
		v.metaTable = mt
	default:
		l.global.metaTables[l.TypeOf(index)] = mt
	}
	l.top--
}
780710
func (s *Store) setMetadata(id string, md map[string]string) error {
	// Check local data first.
	if func() bool {
		s.metaMu.RLock()
		defer s.metaMu.RUnlock()
		if _, ok := s.meta[id]; ok {
			for k, v := range md {
				if s.meta[id][k] != v {
					return false
				}
			}
			return true
		}
		return false
	}() {
		// Local data is same as data being pushed in,
		// nothing to do.
		return nil
	}

	c, err := newMetadataSetCommand(id, md)
	if err != nil {
		return err
	}
	b, err := json.Marshal(c)
	if err != nil {
		return err
	}
	f := s.raft.Apply(b, s.ApplyTimeout)
	if e := f.(raft.Future); e.Error() != nil {
		if e.Error() == raft.ErrNotLeader {
			return ErrNotLeader
		}
		return e.Error()
	}

	return f.Response().(*fsmGenericResponse).error
}
616693
func (s *VirtualNodeData) SetMetadata(v *ResourceMetadata) *VirtualNodeData {
	s.Metadata = v
	return s
}
877119
func (meta Metadata) TrySetValue(key string, value []byte) bool {
	if _, exists := meta[key]; exists {
		meta[key] = value
		return true
	}
	return false
}
176916
func (s *VirtualServiceData) SetMetadata(v *ResourceMetadata) *VirtualServiceData {
	s.Metadata = v
	return s
}
1328314
func (g *TaskGroup) SetMeta(key, val string) *TaskGroup {
	if g.Meta == nil {
		g.Meta = make(map[string]string)
	}
	g.Meta[key] = val
	return g
}
966632
func (s *DescribeThingGroupOutput) SetThingGroupMetadata(v *ThingGroupMetadata) *DescribeThingGroupOutput {
	s.ThingGroupMetadata = v
	return s
}
917695
func (s *ResultSet) SetResultSetMetadata(v *ResultSetMetadata) *ResultSet {
	s.ResultSetMetadata = v
	return s
}
302042
func (meta *Meta) SetSetter(fc func(resource interface{}, metaValue *MetaValue, context *qor.Context)) {
	meta.Setter = fc
}
1272279
func setMeta(resp http.ResponseWriter, m *structs.QueryMeta) {
	setIndex(resp, m.Index)
	setLastContact(resp, m.LastContact)
	setKnownLeader(resp, m.KnownLeader)
}
676229
func (c *ConfigLocal) SetMetadataVersion(mdVer kbfsmd.MetadataVer) {
	c.lock.Lock()
	defer c.lock.Unlock()
	c.metadataVersion = mdVer
}
1021347
func (s *GetDocumentVersionOutput) SetMetadata(v *DocumentVersionMetadata) *GetDocumentVersionOutput {
	s.Metadata = v
	return s
}
614562
func (s *PutObjectInput) SetMetadata(v map[string]*string) *PutObjectInput {
	s.Metadata = v
	return s
}
209236
func (s *InitiateDocumentVersionUploadOutput) SetMetadata(v *DocumentMetadata) *InitiateDocumentVersionUploadOutput {
	s.Metadata = v
	return s
}
1340793
func (s *Upload) SetMetadata(v string) *Upload {
	s.Metadata = &v
	return s
}
1020217
func (s *GetObjectOutput) SetMetadata(v map[string]*string) *GetObjectOutput {
	s.Metadata = v
	return s
}
229145
func (s *Crawler) SetTablePrefix(v string) *Crawler {
	s.TablePrefix = &v
	return s
}