Skip to content
Discussion options

You must be logged in to vote

A few observations upfront:

  • Don't use types from the detail namespace directly (and json_abi_v3_11_2 is an inline namespace and should be omitted in this context). I recommend you pass item.key() and item.value() to parse_json_item().
  • You should pass any nlohmann::basic_json by (const) reference.
  • lua_pushstring(state, val.value().get<std::string>().c_str()) – I hope lua_pushstring creates a copy of the string, otherwise your string will point to invalid memory after the end of the statement. .get_ref<const std::string&>().c_str() avoids this issue and skips creating an unnecessary temporary.

For your primary issue, I'll need to take a look at the source and will update this post shortly.

…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@robinsch
Comment options

@robinsch
Comment options

@falbrechtskirchinger
Comment options

@falbrechtskirchinger
Comment options

Answer selected by robinsch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants