File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,15 @@ impl<'a> MidiSourceScript for LuaMidiSourceScript<'a> {
94
94
self . env
95
95
. raw_set ( self . y_key . clone ( ) , y_value)
96
96
. map_err ( |_| "couldn't set y variable" ) ?;
97
- let context_lua_value = self . lua . as_ref ( ) . to_value ( & context) . unwrap ( ) ;
97
+ let mut serialize_options = mlua:: SerializeOptions :: new ( ) ;
98
+ // This is important, otherwise e.g. a None color ends up as some userdata and not nil.
99
+ serialize_options. serialize_none_to_null = false ;
100
+ serialize_options. serialize_unit_to_null = false ;
101
+ let context_lua_value = self
102
+ . lua
103
+ . as_ref ( )
104
+ . to_value_with ( & context, serialize_options)
105
+ . unwrap ( ) ;
98
106
self . env
99
107
. raw_set ( self . context_key . clone ( ) , context_lua_value)
100
108
. map_err ( |_| "couldn't set context variable" ) ?;
You can’t perform that action at this time.
0 commit comments