webmcp

changeset 232:82cc171e8510

Pass _ENV to loaded chunks
author jbe
date Sat Feb 28 23:11:40 2015 +0100 (2015-02-28)
parents 2eda136b0394
children 827c44692141
files framework/bin/mcp.lua framework/env/execute/chunk.lua framework/env/execute/file_path.lua
line diff
     1.1 --- a/framework/bin/mcp.lua	Sat Feb 28 23:04:43 2015 +0100
     1.2 +++ b/framework/bin/mcp.lua	Sat Feb 28 23:11:40 2015 +0100
     1.3 @@ -100,7 +100,7 @@
     1.4      if file then
     1.5        local filedata = file:read("*a")
     1.6        io.close(file)
     1.7 -      local func, errmsg = load(filedata, "=" .. filename)
     1.8 +      local func, errmsg = load(filedata, "=" .. filename, nil, _ENV)
     1.9        if func then
    1.10          func()
    1.11          return true
     2.1 --- a/framework/env/execute/chunk.lua	Sat Feb 28 23:04:43 2015 +0100
     2.2 +++ b/framework/env/execute/chunk.lua	Sat Feb 28 23:11:40 2015 +0100
     2.3 @@ -35,7 +35,7 @@
     2.4      WEBMCP_BASE_PATH, 'app', app, module, chunk .. '.lua'
     2.5    )
     2.6  
     2.7 -  local func, load_errmsg = loadfile(file_path)
     2.8 +  local func, load_errmsg = loadfile(file_path, nil, _ENV)
     2.9    if not func then
    2.10      error('Could not load file "' .. file_path .. '": ' .. load_errmsg)
    2.11    end
     3.1 --- a/framework/env/execute/file_path.lua	Sat Feb 28 23:04:43 2015 +0100
     3.2 +++ b/framework/env/execute/file_path.lua	Sat Feb 28 23:11:40 2015 +0100
     3.3 @@ -14,7 +14,7 @@
     3.4    local file_path = args.file_path
     3.5    local id        = args.id
     3.6    local params    = args.params
     3.7 -  local func, load_errmsg = loadfile(file_path)
     3.8 +  local func, load_errmsg = loadfile(file_path, nil, _ENV)
     3.9    if not func then
    3.10      error('Could not load file "' .. file_path .. '": ' .. load_errmsg)
    3.11    end

Impressum / About Us