I have struct definitions coming from a DSL interpreted at runtime, and want to create lua userdata types with a custom __index implementation for field accessors. However, I don't see any userdata APIs that don't take a compile-time rust type, so how can I create userdata types at runtime?
Conceptually, I would imagine this is something like lua_newuserdata followed by lua_setmetatable. It would be nice to be able to reference mlua types like Table, but I don't see a way to access the index field for these.
Am I forced to re-implement the high-level mlua API's on top of ffi to implement dynamic lua types at runtime? Am I missing something?
I have struct definitions coming from a DSL interpreted at runtime, and want to create lua userdata types with a custom
__indeximplementation for field accessors. However, I don't see any userdata APIs that don't take a compile-time rust type, so how can I create userdata types at runtime?Conceptually, I would imagine this is something like
lua_newuserdatafollowed bylua_setmetatable. It would be nice to be able to reference mlua types likeTable, but I don't see a way to access theindexfield for these.Am I forced to re-implement the high-level mlua API's on top of
ffito implement dynamic lua types at runtime? Am I missing something?