summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci/util.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-03-21 19:30:53 +0000
committerSteven Barth <steven@midlink.org>2008-03-21 19:30:53 +0000
commitc8426cfa3cce952dde8cdf2eb058d0c2fae4986d (patch)
treed54f94efba36dd8e47cf0dab73a2194365bf734a /src/ffluci/util.lua
parent6e0df95e270dc0ee4c5d10e1d6ac2550f78ff54f (diff)
* ffluci.cbi: updates
* ffluci.template: fixed a bug where different template scopes were not separated correctly * Added ffluci.dispatcher.cbi and ffluci.dispatcher.dynamic
Diffstat (limited to 'src/ffluci/util.lua')
-rw-r--r--src/ffluci/util.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ffluci/util.lua b/src/ffluci/util.lua
index 12031ff7d8..b219be130e 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