Line data Source code
1 :
2 : /*
3 : * Copyright (C) Yichun Zhang (agentzh)
4 : */
5 :
6 :
7 : #ifndef DDEBUG
8 : #define DDEBUG 0
9 : #endif
10 :
11 : #include "ddebug.h"
12 : #include "ngx_http_lua_initby.h"
13 : #include "ngx_http_lua_util.h"
14 :
15 :
16 : ngx_int_t
17 0 : ngx_http_lua_init_by_inline(ngx_log_t *log, ngx_http_lua_main_conf_t *lmcf,
18 : lua_State *L)
19 : {
20 : int status;
21 :
22 0 : status = luaL_loadbuffer(L, (char *) lmcf->init_src.data,
23 : lmcf->init_src.len, "=init_by_lua")
24 0 : || ngx_http_lua_do_call(log, L);
25 :
26 0 : return ngx_http_lua_report(log, L, status, "init_by_lua");
27 : }
28 :
29 :
30 : ngx_int_t
31 0 : ngx_http_lua_init_by_file(ngx_log_t *log, ngx_http_lua_main_conf_t *lmcf,
32 : lua_State *L)
33 : {
34 : int status;
35 :
36 0 : status = luaL_loadfile(L, (char *) lmcf->init_src.data)
37 0 : || ngx_http_lua_do_call(log, L);
38 :
39 0 : return ngx_http_lua_report(log, L, status, "init_by_lua_file");
40 : }
41 :
42 : /* vi:set ft=c ts=4 sw=4 et fdm=marker: */
|