MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / tconcat

Function tconcat

third-party/lua-5.3.5/src/ltablib.c:169–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167
168
169static int tconcat (lua_State *L) {
170 luaL_Buffer b;
171 lua_Integer last = aux_getn(L, 1, TAB_R);
172 size_t lsep;
173 const char *sep = luaL_optlstring(L, 2, "", &lsep);
174 lua_Integer i = luaL_optinteger(L, 3, 1);
175 last = luaL_optinteger(L, 4, last);
176 luaL_buffinit(L, &b);
177 for (; i < last; i++) {
178 addfield(L, &b, i);
179 luaL_addlstring(&b, sep, lsep);
180 }
181 if (i == last) /* add last value (if interval was not empty) */
182 addfield(L, &b, i);
183 luaL_pushresult(&b);
184 return 1;
185}
186
187
188/*

Callers

nothing calls this directly

Calls 6

luaL_optlstringFunction · 0.70
luaL_optintegerFunction · 0.70
luaL_buffinitFunction · 0.70
addfieldFunction · 0.70
luaL_addlstringFunction · 0.70
luaL_pushresultFunction · 0.70

Tested by

no test coverage detected