diff options
Diffstat (limited to 'src/ffluci/util.lua')
-rw-r--r-- | src/ffluci/util.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ffluci/util.lua b/src/ffluci/util.lua index 12031ff7d..b219be130 100644 --- a/src/ffluci/util.lua +++ b/src/ffluci/util.lua @@ -114,7 +114,6 @@ end function extfenv(f, key, obj) local scope = getfenv(f) scope[key] = obj - setfenv(f, scope) end @@ -131,13 +130,20 @@ function instanceof(object, class) end +-- Resets the scope of f doing a shallow copy of its scope into a new table +function resfenv(f) + local scope = getfenv(f) + setfenv(f, {}) + updfenv(f, scope) +end + + -- Updates the scope of f with "extscope" function updfenv(f, extscope) local scope = getfenv(f) for k, v in pairs(extscope) do scope[k] = v end - setfenv(f, scope) end |