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

Function tconcat

third-party/lua-5.2.4/src/ltablib.c:94–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92
93
94static int tconcat (lua_State *L) {
95 luaL_Buffer b;
96 size_t lsep;
97 int i, last;
98 const char *sep = luaL_optlstring(L, 2, "", &lsep);
99 luaL_checktype(L, 1, LUA_TTABLE);
100 i = luaL_optint(L, 3, 1);
101 last = luaL_opt(L, luaL_checkint, 4, luaL_len(L, 1));
102 luaL_buffinit(L, &b);
103 for (; i < last; i++) {
104 addfield(L, &b, i);
105 luaL_addlstring(&b, sep, lsep);
106 }
107 if (i == last) /* add last value (if interval was not empty) */
108 addfield(L, &b, i);
109 luaL_pushresult(&b);
110 return 1;
111}
112
113
114/*

Callers

nothing calls this directly

Calls 7

luaL_lenFunction · 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