webmcp
view framework/env/request/for_each.lua @ 448:e3da778a8bf3
Use snprintf instead of sprintf as a precautionary measure for security
| author | jbe |
|---|---|
| date | Wed Jun 01 19:59:05 2016 +0200 (2016-06-01) |
| parents | c3d539e33710 |
| children |
line source
1 --[[--
2 request.for_each(
3 func -- function to be called on every request
4 )
6 Registers a function to be called on every request and executes it once. This mechanism can be used for __init.lua files in the environment to perform a per-request initialization. See env/request/__init.lua for an example.
8 --]]--
10 function request.for_each(func)
11 local initializers = request._initializers
12 initializers[#initializers+1] = func
13 func()
14 end
