MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tconcat

Function tconcat

freebsd/contrib/openzfs/module/lua/ltablib.c:92–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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