util.envload

This small library abstracts the act of loading a piece of Lua code into a specific environment table.

envload(code, source, env)

Loads code from the string code into the environment env. source is a descriptive name used in errors. Returns a function to be called, or nil, error.

envloadfile(file, env)

Like envload(), except the code is read from the file file.