MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / luaL_gsub

Function luaL_gsub

ThirdParty/lua/lua/lauxlib.c:920–934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

918
919
920LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,
921 const char *r) {
922 const char *wild;
923 size_t l = strlen(p);
924 luaL_Buffer b;
925 luaL_buffinit(L, &b);
926 while ((wild = strstr(s, p)) != NULL) {
927 luaL_addlstring(&b, s, wild - s); /* push prefix */
928 luaL_addstring(&b, r); /* push replacement in place of pattern */
929 s = wild + l; /* continue after 'p' */
930 }
931 luaL_addstring(&b, s); /* push last suffix */
932 luaL_pushresult(&b);
933 return lua_tostring(L, -1);
934}
935
936
937static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {

Callers 4

setprogdirFunction · 0.85
searchpathFunction · 0.85
loadfuncFunction · 0.85
setpathFunction · 0.85

Calls 4

luaL_buffinitFunction · 0.85
luaL_addlstringFunction · 0.85
luaL_addstringFunction · 0.85
luaL_pushresultFunction · 0.85

Tested by

no test coverage detected