findPersistentEnv {basilisk}R Documentation

Find the persistent environment

Description

Find the persistent environment inside a basiliskRun call, to allow variables to be passed across calls.

Usage

findPersistentEnv()

Details

The persistent environment is where variables can be stored across basiliskRun calls. When proc is an environment, it serves as the persistent environment; otherwise, if proc is a process, the global environment of the process is the persistent environment.

It is very important that this function be called inside the frame of the FUN passed to basiliskRun. It should not be called inside nested functions within FUN, otherwise the look-up of the parent.frame will not work correctly.

Author(s)

Aaron Lun

See Also

basiliskRun, where this function can be used.

Examples

cl <- basiliskStart(NULL)
basiliskRun(proc=cl, function() {
    assign(x="snake.in.my.shoes", 1, envir=basilisk::findPersistentEnv())
})
basiliskRun(proc=cl, function() {
    get("snake.in.my.shoes", envir=basilisk::findPersistentEnv())
})
basiliskStop(cl)


[Package basilisk version 0.99.60 Index]