minor string fixes
This commit is contained in:
parent
8b4a3b27c0
commit
d2f0a75d50
@ -721,7 +721,7 @@ function http.json_parser()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function http.logger(format)
|
function http.logger(format)
|
||||||
format = format or ":method :path :status :response-time ms"
|
format = format or "${method} ${path} ${status} ${response-time} ms"
|
||||||
|
|
||||||
return function(req, res, next)
|
return function(req, res, next)
|
||||||
local start_time = os.clock()
|
local start_time = os.clock()
|
||||||
|
@ -96,7 +96,7 @@ func NewWorkerPool(size int, masterState *luajit.State, stateCreator StateCreato
|
|||||||
workerCount: size,
|
workerCount: size,
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < size; i++ {
|
for i := range size {
|
||||||
worker, err := pool.createWorker(i)
|
worker, err := pool.createWorker(i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pool.Close()
|
pool.Close()
|
||||||
|
@ -642,7 +642,7 @@ function string.template(template_str, vars)
|
|||||||
if type(template_str) ~= "string" then error("string.template: first argument must be a string", 2) end
|
if type(template_str) ~= "string" then error("string.template: first argument must be a string", 2) end
|
||||||
if type(vars) ~= "table" then error("string.template: second argument must be a table", 2) end
|
if type(vars) ~= "table" then error("string.template: second argument must be a table", 2) end
|
||||||
|
|
||||||
return template_str:gsub("%${([%w_%.]+)}", function(path)
|
return template_str:gsub("%${([%w_%.-]+)}", function(path)
|
||||||
local value = vars
|
local value = vars
|
||||||
|
|
||||||
-- Handle simple variables (no dots)
|
-- Handle simple variables (no dots)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user