summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci/template.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/template.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/template.lua')
-rw-r--r--src/ffluci/template.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ffluci/template.lua b/src/ffluci/template.lua
index 00145a0a0..18265a4a1 100644
--- a/src/ffluci/template.lua
+++ b/src/ffluci/template.lua
@@ -124,12 +124,13 @@ function compile(template)
end
-- Oldstyle render shortcut
-function render(name, ...)
+function render(name, scope, ...)
+ scope = scope or getfenv(2)
local s, t = pcall(Template, name)
if not s then
error("Unable to load template: " .. name)
else
- t:render(...)
+ t:render(scope, ...)
end
end
@@ -208,6 +209,7 @@ function Template.render(self, scope)
local oldfenv = getfenv(self.template)
-- Put our predefined objects in the scope of the template
+ ffluci.util.resfenv(self.template)
ffluci.util.updfenv(self.template, scope)
ffluci.util.updfenv(self.template, self.viewns)