| 180 | |
| 181 | |
| 182 | static 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 | |
| 200 | static int tlength(lua_State *L) |
| 201 | { |
nothing calls this directly
no test coverage detected