MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaL_addgsub

Function luaL_addgsub

lib/lua/src/lauxlib.c:1003–1013  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1001
1002
1003LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s,
1004 const char *p, const char *r) {
1005 const char *wild;
1006 size_t l = strlen(p);
1007 while ((wild = strstr(s, p)) != NULL) {
1008 luaL_addlstring(b, s, wild - s); /* push prefix */
1009 luaL_addstring(b, r); /* push replacement in place of pattern */
1010 s = wild + l; /* continue after 'p' */
1011 }
1012 luaL_addstring(b, s); /* push last suffix */
1013}
1014
1015
1016LUALIB_API const char *luaL_gsub (lua_State *L, const char *s,

Callers 3

luaL_gsubFunction · 0.85
pusherrornotfoundFunction · 0.85
searchpathFunction · 0.85

Calls 2

luaL_addlstringFunction · 0.85
luaL_addstringFunction · 0.85

Tested by

no test coverage detected