webmcp
diff framework/env/execute/chunk.lua @ 309:4e69ce9a6365
Mechanism to load, compile, and cache Lua code from the filesystem
author | jbe |
---|---|
date | Sun Mar 22 22:25:37 2015 +0100 (2015-03-22) |
parents | 82cc171e8510 |
children | ba68ef9e7c90 |
line diff
1.1 --- a/framework/env/execute/chunk.lua Sun Mar 22 20:39:13 2015 +0100 1.2 +++ b/framework/env/execute/chunk.lua Sun Mar 22 22:25:37 2015 +0100 1.3 @@ -1,7 +1,7 @@ 1.4 --[[-- 1.5 return_value = -- return value of executed chunk 1.6 execute.chunk{ 1.7 - file_path = file_path, -- path to a lua source or byte-code file 1.8 + file_path = file_path, -- path to a Lua source or byte-code file 1.9 app = app, -- app name to use or the current will be used 1.10 module = module, -- module where chunk is located 1.11 chunk = chunk -- name of chunk (filename without .lua extension) 1.12 @@ -35,7 +35,7 @@ 1.13 WEBMCP_BASE_PATH, 'app', app, module, chunk .. '.lua' 1.14 ) 1.15 1.16 - local func, load_errmsg = loadfile(file_path, nil, _ENV) 1.17 + local func, load_errmsg = loadcached(file_path) 1.18 if not func then 1.19 error('Could not load file "' .. file_path .. '": ' .. load_errmsg) 1.20 end