forked from openresty/lua-nginx-module
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathngx_http_lua_initby.c
More file actions
42 lines (29 loc) · 898 Bytes
/
Copy pathngx_http_lua_initby.c
File metadata and controls
42 lines (29 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* Copyright (C) Yichun Zhang (agentzh)
*/
#ifndef DDEBUG
#define DDEBUG 0
#endif
#include "ddebug.h"
#include "ngx_http_lua_initby.h"
#include "ngx_http_lua_util.h"
ngx_int_t
ngx_http_lua_init_by_inline(ngx_log_t *log, ngx_http_lua_main_conf_t *lmcf,
lua_State *L)
{
int status;
status = luaL_loadbuffer(L, (char *) lmcf->init_src.data,
lmcf->init_src.len, "=init_by_lua")
|| ngx_http_lua_do_call(log, L);
return ngx_http_lua_report(log, L, status, "init_by_lua");
}
ngx_int_t
ngx_http_lua_init_by_file(ngx_log_t *log, ngx_http_lua_main_conf_t *lmcf,
lua_State *L)
{
int status;
status = luaL_loadfile(L, (char *) lmcf->init_src.data)
|| ngx_http_lua_do_call(log, L);
return ngx_http_lua_report(log, L, status, "init_by_lua_file");
}
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */