diff options
author | Steven Barth <steven@midlink.org> | 2008-03-21 19:30:53 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-03-21 19:30:53 +0000 |
commit | c8426cfa3cce952dde8cdf2eb058d0c2fae4986d (patch) | |
tree | d54f94efba36dd8e47cf0dab73a2194365bf734a /src/ffluci/template.lua | |
parent | 6e0df95e270dc0ee4c5d10e1d6ac2550f78ff54f (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.lua | 6 |
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) |