| 209 | |
| 210 | |
| 211 | static int writer (lua_State *L, const void *b, size_t size, void *ud) { |
| 212 | struct str_Writer *state = (struct str_Writer *)ud; |
| 213 | if (!state->init) { |
| 214 | state->init = 1; |
| 215 | luaL_buffinit(L, &state->B); |
| 216 | } |
| 217 | if (b == NULL) { /* finishing dump? */ |
| 218 | luaL_pushresult(&state->B); /* push result */ |
| 219 | lua_replace(L, 1); /* move it to reserved slot */ |
| 220 | } |
| 221 | else |
| 222 | luaL_addlstring(&state->B, (const char *)b, size); |
| 223 | return 0; |
| 224 | } |
| 225 | |
| 226 | |
| 227 | static int str_dump (lua_State *L) { |
nothing calls this directly
no test coverage detected