code: func (l *State) ToThread(index int) *State {
  	if t, ok := l.indexToValue(index).(*State); ok {
  		return t
  	}
  	return nil
  }
docs: // ToThread converts the value at index to a Lua thread (a State). This
  // value must be a thread, otherwise the return value will be nil.
  //
  // http://www.lua.org/manual/5.2/manual.html#lua_tothread