| 142 | |
| 143 | |
| 144 | static int tconcat (lua_State *L) { |
| 145 | luaL_Buffer b; |
| 146 | size_t lsep; |
| 147 | int i, last; |
| 148 | const char *sep = luaL_optlstring(L, 2, "", &lsep); |
| 149 | luaL_checktype(L, 1, LUA_TTABLE); |
| 150 | i = luaL_optint(L, 3, 1); |
| 151 | last = luaL_opt(L, luaL_checkint, 4, luaL_getn(L, 1)); |
| 152 | luaL_buffinit(L, &b); |
| 153 | for (; i < last; i++) { |
| 154 | addfield(L, &b, i); |
| 155 | luaL_addlstring(&b, sep, lsep); |
| 156 | } |
| 157 | if (i == last) /* add last value (if interval was not empty) */ |
| 158 | addfield(L, &b, i); |
| 159 | luaL_pushresult(&b); |
| 160 | return 1; |
| 161 | } |
| 162 | |
| 163 | |
| 164 |
nothing calls this directly
no test coverage detected