| 985 | |
| 986 | |
| 987 | LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s, |
| 988 | const char *p, const char *r) { |
| 989 | const char *wild; |
| 990 | size_t l = strlen(p); |
| 991 | while ((wild = strstr(s, p)) != NULL) { |
| 992 | luaL_addlstring(b, s, wild - s); /* push prefix */ |
| 993 | luaL_addstring(b, r); /* push replacement in place of pattern */ |
| 994 | s = wild + l; /* continue after 'p' */ |
| 995 | } |
| 996 | luaL_addstring(b, s); /* push last suffix */ |
| 997 | } |
| 998 | |
| 999 | |
| 1000 | LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, |
no test coverage detected