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

Function tconcat

other_src/lua/src/ltablib.cpp:151–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected