Skip to content

Implement ToLua for a particular HashMap type #271

Answered by khvzak
RageCage64 asked this question in Q&A
Discussion options

You must be logged in to vote

Probably you don't even need ToLua implementation for RecordValidType.
mlua (with serialize feature flag) support integration with serde. If you add derive(Serialize) to RecordValidType then should be able to automatically convert it to Lua.
Eg:

let lua_val = lua.to_value(&RecordValidType::Number(1.0))?;

You just need to import LuaSerdeExt trait.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RageCage64
Comment options

Answer selected by RageCage64
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