Skip to content

Support abstract [LuaObject] classes#302

Open
ashtonmeuser wants to merge 1 commit intonuskey8:mainfrom
ashtonmeuser:abstract-support
Open

Support abstract [LuaObject] classes#302
ashtonmeuser wants to merge 1 commit intonuskey8:mainfrom
ashtonmeuser:abstract-support

Conversation

@ashtonmeuser
Copy link
Copy Markdown
Contributor

The guard against abstract classes is, in my opinion, a little conservative. Users who desire an abstract parent class may simply drop abstract to appease Lua-CSharp, which is a worse compromise.

If I've overlooked a massive trap, please let me know.

@ashtonmeuser
Copy link
Copy Markdown
Contributor Author

Perhaps this isn't necessary. The abstract parent class can simply omit [LuaObject] and add [LuaMember] all the same. A concrete child class with [LuaObject] will pick these up. For example:

public abstract partial class ParentClass
{
    [LuaMember("value")]
    public string Value { get; set; } = "";
}

[LuaObject]
public partial class ChildClass : ParentClass
{
    [LuaMember("number")]
    public int Number { get; set; }
}

ChildClass still has access to value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant