lk.Environment

.__index (env, name)

local lib = {type='lk.Environment'} lk.Environment = lib

setmetatable(lib, { -- new method __call = function(lib, code_str) local code = assert(loadstring(code_str)) -- new environment local env = {} setmetatable(env, lib) setfenv(code, env) return code end})