| 818 | } |
| 819 | |
| 820 | static int Lbuf_pack(lua_State *L) { |
| 821 | pb_Buffer b, *pb = test_buffer(L, 1); |
| 822 | int idx = 1 + (pb != NULL); |
| 823 | const char *fmt = luaL_checkstring(L, idx++); |
| 824 | if (pb == NULL) pb_initbuffer(pb = &b); |
| 825 | lpb_packfmt(L, idx, pb, &fmt, 0); |
| 826 | if (pb != &b) |
| 827 | lua_settop(L, 1); |
| 828 | else { |
| 829 | pb_Slice ret = pb_result(pb); |
| 830 | push_slice(L, ret); |
| 831 | pb_resetbuffer(pb); |
| 832 | } |
| 833 | return 1; |
| 834 | } |
| 835 | |
| 836 | LUALIB_API int luaopen_pb_buffer(lua_State *L) { |
| 837 | luaL_Reg libs[] = { |
nothing calls this directly
no test coverage detected