From: Nicolas Boisselier Date: Wed, 16 May 2018 14:05:42 +0000 (+0100) Subject: lib/lua/nb.lua X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=5bc9fbd1192fd2c8aa31ec6a8aa5d90270c826e6;p=nb.git lib/lua/nb.lua --- diff --git a/lib/lua/nb.lua b/lib/lua/nb.lua index cb5cae6c..83ae42ce 100644 --- a/lib/lua/nb.lua +++ b/lib/lua/nb.lua @@ -17,6 +17,11 @@ function nb:readall(file) end end +function nb:ngx_tmpl_file(file,fheader,ffooter) + ngx.ctx.tmpl_content = self:readall(file) + self:ngx_location_tmpl(fheader,ffooter) +end + function nb:ngx_tmpl(content,fheader,ffooter) ngx.ctx.tmpl_content = content self:ngx_location_tmpl(fheader,ffooter) @@ -134,4 +139,9 @@ function nb:ngx_cmd(cmd) return 0 end +function nb:script_path() + local str = debug.getinfo(2, "S").source:sub(2) + return str:match("(.*)/") +end + return nb