+ end
+
+ if c and (c.index or type(target) == "function") then
+ ctx.dispatched = c
+ ctx.requested = ctx.requested or ctx.dispatched
+ end
+
+ if c and c.index then
+ local tpl = require "luci.template"
+
+ if util.copcall(tpl.render, "indexer", {}) then
+ return true
+ end
+ end
+
+ if type(target) == "function" then
+ util.copcall(function()
+ local oldenv = getfenv(target)
+ local module = require(c.module)
+ local env = setmetatable({}, {__index=
+
+ function(tbl, key)
+ return rawget(tbl, key) or module[key] or oldenv[key]
+ end})
+
+ setfenv(target, env)
+ end)
+
+ if type(c.target) == "table" then
+ target(c.target, unpack(args))
+ else
+ target(unpack(args))