diff options
author | Kim Alvefur <zash@zash.se> | 2014-09-18 02:22:48 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-09-18 02:22:48 +0200 |
commit | 31be1596b93612e1c848402bd21207ad06ae30e8 (patch) | |
tree | 361f642064745fd1a6601050e7573062ff65e2ad /prosody | |
parent | 57b543c70405092fc24f859c05c734fc8b361030 (diff) | |
parent | b19f5a09a19534973d522e7400139f040d76391b (diff) | |
download | prosody-31be1596b93612e1c848402bd21207ad06ae30e8.tar.gz prosody-31be1596b93612e1c848402bd21207ad06ae30e8.zip |
Merge 0.10->trunk
Diffstat (limited to 'prosody')
-rwxr-xr-x | prosody | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -153,7 +153,12 @@ function sandbox_require() local _real_require = require; if not getfenv then -- FIXME: This is a hack to replace getfenv() in Lua 5.2 - function getfenv(f) return debug.getupvalue(debug.getinfo(f or 1).func, 1); end + function getfenv(f) + local name, env = debug.getupvalue(debug.getinfo(f or 1).func, 1); + if name == "_ENV" then + return env; + end + end end function require(...) local curr_env = getfenv(2); |