| 477 | |
| 478 | |
| 479 | LUALIB_API void luaL_addvalue (luaL_Buffer *B) { |
| 480 | lua_State *L = B->L; |
| 481 | size_t vl; |
| 482 | const char *s = lua_tolstring(L, -1, &vl); |
| 483 | if (vl <= bufffree(B)) { /* fit into buffer? */ |
| 484 | memcpy(B->p, s, vl); /* put it there */ |
| 485 | B->p += vl; |
| 486 | lua_pop(L, 1); /* remove from stack */ |
| 487 | } |
| 488 | else { |
| 489 | if (emptybuffer(B)) |
| 490 | lua_insert(L, -2); /* put buffer before new value */ |
| 491 | B->lvl++; /* add new value into B stack */ |
| 492 | adjuststack(B); |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | |
| 497 | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { |
no test coverage detected