diff options
| author | ruki <[email protected]> | 2021-09-18 11:36:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-18 11:36:25 +0800 |
| commit | 2fc5c39261e8fda47e5376744e7b5c17d6431e97 (patch) | |
| tree | bda5882f47f18a1a44dad86d07e3f26ba8be9f18 /xmake/core/_xmake_main.lua | |
| parent | 151102e2b32a11f2a02da00c8236e285b01b19f1 (diff) | |
improve getfenv and setfenv
Diffstat (limited to 'xmake/core/_xmake_main.lua')
| -rw-r--r-- | xmake/core/_xmake_main.lua | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/xmake/core/_xmake_main.lua b/xmake/core/_xmake_main.lua index 94045a2f5..47197d7bb 100644 --- a/xmake/core/_xmake_main.lua +++ b/xmake/core/_xmake_main.lua @@ -36,41 +36,6 @@ xmake._WORKING_DIR = os.curdir() xmake._FEATURES = _FEATURES xmake._LUAJIT = _LUAJIT --- init setfenv/getfenv for lua -if not getfenv then - function getfenv(fn) - local i = 1 - while true do - local name, val = debug.getupvalue(fn, i) - if name == "_ENV" then - return val - elseif not name then - break - end - i = i + 1 - end - end -end -if not setfenv then - function setfenv(fn, env) - local i = 1 - while true do - local name = debug.getupvalue(fn, i) - if name == "_ENV" then - debug.upvaluejoin(fn, i, (function() - return env - end), 1) - break - elseif not name then - break - end - - i = i + 1 - end - return fn - end -end - -- load the given lua file function _loadfile_impl(filepath, mode, opt) |
