Skip to content

Internal constructor in a module #227

@NanoBob

Description

@NanoBob

We have a class with the following constructors in a module:

        internal Resource(MtaResource resource)
        {
            resources.Add(resource, this);
            MtaResource = resource;
        }

        protected Resource(string name) : this(MtaShared.GetResourceFromName(name)) { }

        public Resource(string name, string organizationalDir = null) : this(MtaServer.CreateResource(name, organizationalDir)) { }

Note the first constructor is internal.

Then in a non-module project we have:

    public class TestResource: Resource
    {
        public TestResource(): base("test")
        {

        }
    }

This call to base() should call the second constructor, but instead the compiled Lua calls:

System.base(this).__ctor__[1](this, "test")

Whereas when we make the constructor protected instead of internal it does take constructor 2

System.base(this).__ctor__[2](this, "test")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions