1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/call.R
3\name{call_fn}
4\alias{call_fn}
5\title{Extract function from a call}
6\usage{
7call_fn(call, env = caller_env())
8}
9\arguments{
10\item{call}{Can be a call or a quosure that wraps a call.}
11
12\item{env}{The environment where to find the definition of the
13function quoted in \code{call} in case \code{call} is not wrapped in a
14quosure.}
15}
16\description{
17If a frame or formula, the function will be retrieved from the
18associated environment. Otherwise, it is looked up in the calling
19frame.
20}
21\section{Life cycle}{
22
23
24In rlang 0.2.0, \code{lang_fn()} was deprecated and renamed to
25\code{call_fn()}. See lifecycle section in \code{\link[=call2]{call2()}} for more about this
26change.
27}
28
29\examples{
30# Extract from a quoted call:
31call_fn(quote(matrix()))
32call_fn(quo(matrix()))
33
34# Extract the calling function
35test <- function() call_fn(call_frame())
36test()
37}
38\seealso{
39\code{\link[=call_name]{call_name()}}
40}
41