diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-10-15 16:12:07 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-10-15 16:12:07 +0000 |
commit | f7ab1fbc5606adfff36f5605f159be568a31690e (patch) | |
tree | f779c6aecbcddf2420e89edb32fc18b8f716c1ae /libs/web/luasrc/dispatcher.lua | |
parent | 44cd848b28557555fe7ffd9f105964f18b5a9db3 (diff) |
libs/web: add export() to template namespace, allows templates to export symbols to the calling view namespace, this is useful for includes defining shared procedures or variables
Diffstat (limited to 'libs/web/luasrc/dispatcher.lua')
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index b79fdd38b..8d5c02e60 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -237,6 +237,7 @@ function dispatch(request) write = luci.http.write; include = function(name) tpl.Template(name):render(getfenv(2)) end; translate = function(...) return require("luci.i18n").translate(...) end; + export = function(k, v) if tpl.context.viewns[k] == nil then tpl.context.viewns[k] = v end end; striptags = util.striptags; pcdata = util.pcdata; media = media; |