Skip to content

Commit

Permalink
优化bson代码
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyoo0812 committed May 23, 2024
1 parent 421ae14 commit eea003a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion extend/lbson/src/bson.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ namespace lbson {
int pairs(lua_State* L) {
m_buffer.clean();
size_t data_len = 0;
m_buffer.write<uint8_t>(0);
m_buffer.write<uint8_t>((uint8_t)bson_type::BSON_DOCUMENT);
uint8_t* data = encode_pairs(L, &data_len);
return make_bson_value(L, bson_type::BSON_DOCUMENT, data, data_len);
lua_pushlstring(L, (const char*)data, data_len);
return 1;
}

int binary(lua_State* L) {
Expand Down

0 comments on commit eea003a

Please sign in to comment.