MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tconcat

Function tconcat

app/redis-6.2.6/deps/lua/src/ltablib.c:144–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142
143
144static int tconcat (lua_State *L) {
145 luaL_Buffer b;
146 size_t lsep;
147 int i, last;
148 const char *sep = luaL_optlstring(L, 2, "", &lsep);
149 luaL_checktype(L, 1, LUA_TTABLE);
150 i = luaL_optint(L, 3, 1);
151 last = luaL_opt(L, luaL_checkint, 4, luaL_getn(L, 1));
152 luaL_buffinit(L, &b);
153 for (; i < last; i++) {
154 addfield(L, &b, i);
155 luaL_addlstring(&b, sep, lsep);
156 }
157 if (i == last) /* add last value (if interval was not empty) */
158 addfield(L, &b, i);
159 luaL_pushresult(&b);
160 return 1;
161}
162
163
164

Callers

nothing calls this directly

Calls 7

luaL_getnFunction · 0.85
luaL_optlstringFunction · 0.70
luaL_checktypeFunction · 0.70
luaL_buffinitFunction · 0.70
addfieldFunction · 0.70
luaL_addlstringFunction · 0.70
luaL_pushresultFunction · 0.70

Tested by

no test coverage detected