@@ -147,6 +147,13 @@ static int ngx_http_lua_get_raw_phase_context(lua_State *L);
147147#define LUA_PATH_SEP ";"
148148#endif
149149
150+
151+ #if !defined(LUA_DEFAULT_PATH ) && (NGX_DEBUG )
152+ #define LUA_DEFAULT_PATH "../lua-resty-core/lib/?.lua;" \
153+ "../lua-resty-lrucache/lib/?.lua"
154+ #endif
155+
156+
150157#define AUX_MARK "\1"
151158
152159
@@ -3813,6 +3820,7 @@ ngx_http_lua_init_vm(lua_State *parent_vm, ngx_cycle_t *cycle,
38133820 ngx_pool_t * pool , ngx_http_lua_main_conf_t * lmcf , ngx_log_t * log ,
38143821 ngx_pool_cleanup_t * * pcln )
38153822{
3823+ int rc ;
38163824 lua_State * L ;
38173825 ngx_uint_t i ;
38183826 ngx_pool_cleanup_t * cln ;
@@ -3880,6 +3888,21 @@ ngx_http_lua_init_vm(lua_State *parent_vm, ngx_cycle_t *cycle,
38803888 lua_pop (L , 2 );
38813889 }
38823890
3891+ if (lmcf -> load_resty_core ) {
3892+ lua_getglobal (L , "require" );
3893+ lua_pushstring (L , "resty.core" );
3894+
3895+ rc = lua_pcall (L , 1 , 1 , 0 );
3896+ if (rc != 0 ) {
3897+ ngx_log_error (NGX_LOG_ERR , log , 0 ,
3898+ "lua_load_resty_core failed to load the resty.core "
3899+ "module from https://github.com/openresty/lua-resty"
3900+ "-core; ensure you are using an OpenResty release "
3901+ "from https://openresty.org/en/download.html "
3902+ "(rc: %i, reason: %s)" , rc , lua_tostring (L , -1 ));
3903+ }
3904+ }
3905+
38833906 return L ;
38843907}
38853908
0 commit comments