Skip to content

Commit

Permalink
Rearrange decode function
Browse files Browse the repository at this point in the history
  • Loading branch information
JopStro committed May 6, 2024
1 parent 8d8fb6c commit 6d249b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ fn decode<'lua>(lua: &'lua Lua, s: LuaValue<'lua>) -> LuaResult<LuaValue<'lua>>
}

fn encode<'lua>(lua: &'lua Lua, v: LuaValue<'lua>) -> LuaResult<LuaValue<'lua>> {
lua.create_string(j5::to_string(&v).map_err(LuaError::external)?)
.map(LuaValue::String)
let s = j5::to_string(&v).map_err(LuaError::external)?;
lua.create_string(s).map(LuaValue::String)
}

#[mlua::lua_module]
Expand Down

0 comments on commit 6d249b0

Please sign in to comment.