feature(hlua): #[derive(Push, LuaRead)] for structs & enums
requires !68 (merged) closes #34 (closed)
Structs with named fields correspond to tables
(struct S { x: i32, y: f32 }
<-> return { x = number, y = number }
)
Struct with unnamed fields:
- As an enum variant: is equivalent to tuples and correspond to
multiple values on the stack
(
struct S(i32, f32)
<->return number, number;
). - Standalone structs with unnamed fields are not supported because they are unintuitive and aren't used very often.
Enums represent a one of the alternative values
(enum E { Num: i32, Table { x: i32, f: f32 } }
<-> return number;
or
return { x = number, y = number };
)
Unit structs are not supported yet, so are enums variants without
associated data.
(enum E { X, Y }
, struct S; <- not supported by derive macros)
Edited by Alexey Protsenko