libs/web: add export() to template namespace, allows templates to export symbols...
[project/luci.git] / libs / web / luasrc / dispatcher.lua
index b79fdd3..8d5c02e 100644 (file)
@@ -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;