Skip to content
Discussion options

You must be logged in to vote

UD Descriptors

Yes, this functionality is already supported with user data descriptors.

However, I haven't yet implemented the attribute-based approach for it. It requires significant effort to ensure efficient and customizable implementation, which means that, for now, you'll need to manually implement the necessary boilerplate code yourself.

Here's a simple example that demonstrates getting and setting a .NET property with Lua through a descriptor:

using (var lua = new Lua())
{
    lua.Marshaler.UserDataDescriptorProvider.SetDescriptor(typeof(MyClass), new MyClassUserDataDecriptor());
    
    lua.SetGlobal("myclass", new MyClass());
    
    lua.Execute("myclass.text = 'Hello, World!'");

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@QuantumToasted
Comment options

Answer selected by QuantumToasted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants