MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / tconcat

Function tconcat

src/Chain/libraries/glua/ltablib.cpp:182–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180
181
182static int tconcat(lua_State *L) {
183 luaL_Buffer b;
184 lua_Integer last = aux_getn(L, 1, TAB_R);
185 size_t lsep;
186 const char *sep = luaL_optlstring(L, 2, "", &lsep);
187 lua_Integer i = luaL_optinteger(L, 3, 1);
188 last = luaL_opt(L, luaL_checkinteger, 4, last);
189 luaL_buffinit(L, &b);
190 for (; i < last; i++) {
191 addfield(L, &b, i);
192 luaL_addlstring(&b, sep, lsep);
193 }
194 if (i == last) /* add last value (if interval was not empty) */
195 addfield(L, &b, i);
196 luaL_pushresult(&b);
197 return 1;
198}
199
200static int tlength(lua_State *L)
201{

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected