| 500 | |
| 501 | |
| 502 | LUALIB_API void luaL_addvalue (luaL_Buffer *B) { |
| 503 | lua_State *L = B->L; |
| 504 | size_t vl; |
| 505 | const char *s = lua_tolstring(L, -1, &vl); |
| 506 | if (vl <= bufffree(B)) { /* fit into buffer? */ |
| 507 | memcpy(B->p, s, vl); /* put it there */ |
| 508 | B->p += vl; |
| 509 | lua_pop(L, 1); /* remove from stack */ |
| 510 | } |
| 511 | else { |
| 512 | if (emptybuffer(B)) |
| 513 | lua_insert(L, -2); /* put buffer before new value */ |
| 514 | B->lvl++; /* add new value into B stack */ |
| 515 | adjuststack(B); |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | |
| 520 | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { |
no test coverage detected