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