luci-lua-runtime: also search luci.dispatcher scope when looking up values

Some legacy templates access dispatcher functions such as `build_url()`
without explicit scope, which worked in the old runtime since the template
view namespace was instantiated from the dispatcher.

Ensure that this continues to function in the emulated runtime.

Fixes: #6082
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2022-11-09 20:37:54 +01:00
parent bdfdd95a27
commit fd7427c4e5

View file

@ -121,7 +121,7 @@ context.viewns = setmetatable({
elseif key == "resource" then
return L.config.main.resourcebase
else
return rawget(tbl, key) or _G[key] or L[key]
return rawget(tbl, key) or disp[key] or _G[key] or L[key]
end
end})