Open kevzhao2 opened 4 years ago
One potential strategy for supporting CLR <-> Lua interop is to make use of dynamic code generation.
For any type T
which needs to CLR <-> Lua interop, we can do something like the following:
[ ] Generate a type-specific metatable that all instances of T
will use in Lua, with the following:
__index
: A dynamic method which will take the supplied index, and do one of the following: perform a field get, perform a property get, or return a proxy C function for method calling.Note that we don't necessarily need to marshal the supplied index to a string
if we're just performing direct byte comparisons. This will potentially save a string
allocation.
__newindex
: A dynamic method which will take the supplied index, and do one of the following: perform a field set or perform a property set.
Checklist for Triton modernization (v2.0.0):
More to come as I think of them.