From fe0bf2bc1a0b5eea99d407622cae7266e3cc6fd4 Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Wed, 1 Nov 2023 22:58:01 -0500 Subject: [PATCH] Allow way to get environment for user functions --- R/rudf.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R/rudf.R b/R/rudf.R index c5d1b82d..79fedd07 100644 --- a/R/rudf.R +++ b/R/rudf.R @@ -151,18 +151,18 @@ rxRmFunParse <- function(name) { } #' Setup the UDF environment (for querying user defined funtions) #' -#' @param env environment where user defined functions are queried -#' @return nothing called for side effects +#' @param env environment where user defined functions are queried. If NULL return current environment +#' @return environment #' @export #' @author Matthew L. Fidler #' @keywords internal .udfEnvSet <- function(env) { - if (.udfEnv$lockedEnvir) return(invisible()) + if (.udfEnv$lockedEnvir) return(invisible(.udfEnv$envir)) if (is.environment(env)) { .udfEnv$envir <- env - return(invisible()) + return(invisible(.udfEnv$envir)) } - stop("'env' needs to be an environment") + return(invisible(.udfEnv$envir)) } #' Lock/Unlock environment for getting R user functions #'