1.插入api
*/src/luam/src/ngx_http_lua_regex.c
void
ngx_http_lua_inject_regex_api(lua_State *L)
{
/* ngx.re */
lua_createtable(L, 0, 5 /* nrec */); /* .re */
lua_pushcfunction(L, ngx_http_lua_ngx_re_find);
lua_setfield(L, -2, "find");
lua_pushcfunction(L, ngx_http_lua_ngx_re_match);
lua_setfield(L, -2, "match");
lua_pushcfunction(L, ngx_http_lua_ngx_re_gmatch);
lua_setfield(L, -2, "gmatch");
lua_pushcfunction(L, ngx_http_lua_ngx_re_sub);
lua_setfield(L, -2, "sub");
lua_pushcfunction(L, ngx_http_lua_ngx_re_gsub);
lua_setfield(L, -2, "gsub");
lua_setfield(L, -2, "re");
}

这篇文章介绍了如何在ngx_http_lua_regex.c中通过lua_createtable向lua_State中添加正则表达式API函数,如find、match、gmatch、sub和gsub。
1176

被折叠的 条评论
为什么被折叠?



