MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / tconcat

Function tconcat

3rd/lua-5.4.3/src/ltablib.c:155–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154
155static int tconcat (lua_State *L) {
156 luaL_Buffer b;
157 lua_Integer last = aux_getn(L, 1, TAB_R);
158 size_t lsep;
159 const char *sep = luaL_optlstring(L, 2, "", &lsep);
160 lua_Integer i = luaL_optinteger(L, 3, 1);
161 last = luaL_optinteger(L, 4, last);
162 luaL_buffinit(L, &b);
163 for (; i < last; i++) {
164 addfield(L, &b, i);
165 luaL_addlstring(&b, sep, lsep);
166 }
167 if (i == last) /* add last value (if interval was not empty) */
168 addfield(L, &b, i);
169 luaL_pushresult(&b);
170 return 1;
171}
172
173
174/*

Callers

nothing calls this directly

Calls 6

luaL_optlstringFunction · 0.85
luaL_optintegerFunction · 0.85
luaL_buffinitFunction · 0.85
addfieldFunction · 0.85
luaL_addlstringFunction · 0.85
luaL_pushresultFunction · 0.85

Tested by

no test coverage detected