| 153 | |
| 154 | |
| 155 | static int tconcat (lua_State *L) { |
| 156 | luaL_Buffer b; |
| 157 | lua_Integer last = aux_getn(L, 1, TAB_R); |
| 158 | size_t lsep; |
| 159 | const char *sep = luaL_optlstring(L, 2, "", &lsep); |
| 160 | lua_Integer i = luaL_optinteger(L, 3, 1); |
| 161 | last = luaL_optinteger(L, 4, last); |
| 162 | luaL_buffinit(L, &b); |
| 163 | for (; i < last; i++) { |
| 164 | addfield(L, &b, i); |
| 165 | luaL_addlstring(&b, sep, lsep); |
| 166 | } |
| 167 | if (i == last) /* add last value (if interval was not empty) */ |
| 168 | addfield(L, &b, i); |
| 169 | luaL_pushresult(&b); |
| 170 | return 1; |
| 171 | } |
| 172 | |
| 173 | |
| 174 | /* |
nothing calls this directly
no test coverage detected