| 10664 | |
| 10665 | |
| 10666 | LUALIB_API void luaL_addvalue (luaL_Buffer *B) { |
| 10667 | lua_State *L = B->L; |
| 10668 | size_t vl; |
| 10669 | const char *s = lua_tolstring(L, -1, &vl); |
| 10670 | if (vl <= bufffree(B)) { /* fit into buffer? */ |
| 10671 | memcpy(B->p, s, vl); /* put it there */ |
| 10672 | B->p += vl; |
| 10673 | lua_pop(L, 1); /* remove from stack */ |
| 10674 | } |
| 10675 | else { |
| 10676 | if (emptybuffer(B)) |
| 10677 | lua_insert(L, -2); /* put buffer before new value */ |
| 10678 | B->lvl++; /* add new value into B stack */ |
| 10679 | adjuststack(B); |
| 10680 | } |
| 10681 | } |
| 10682 | |
| 10683 | |
| 10684 | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { |
no test coverage detected