Set a new environment for this function.
The environment of a function is the table used for looking up non-local (global) variables.
new environment
lua["foo"] = "bar"; auto func = lua.loadString(`return foo`); assert(func.call!string() == "bar"); auto env = lua.wrap(["foo": "test"]); func.setEnvironment(env); assert(func.call!string() == "test");
See Implementation
Set a new environment for this function.
The environment of a function is the table used for looking up non-local (global) variables.