% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/env.r
\name{topenv}
\alias{topenv}
\title{Get a module’s namespace environment}
\usage{
\special{box::topenv()}

\special{box::topenv(env)}
}
\arguments{
\item{module}{a module environment}
}
\value{
\code{box::topenv()} returns the top-level module environment of the
module it is called from, or the nearest top-level non-module environment
otherwise; this is usually \code{.GlobalEnv}.

\code{box::topenv(env)} returns the nearest top-level environment that is a
direct or indirect parent of \code{env}.
}
\description{
Called inside a module, \code{box::topenv()} returns the module namespace
environment. Otherwise, it behaves similarly to \code{\link[base]{topenv}}.
}
