problem with same method in class and base class #117

Closed
karsten001 opened this Issue Oct 26, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@karsten001

My last issue with a similar problem has been fixed so fast, thank you very much for doing this. I found another issue. If the base class has the same method with different parameters lua always tries to match the method to the main class and so you will get an error that the parameter does not match.

C# classes

public class parameter
{
    string param1;
    string param2;
}

public class master
{
    public static string read( parameter test )
    {
        return "test";
    }
}


public class testClass : master 
{
    public String strData;
    public int intData;
    public static string read( int test )
    {
        return "test";
    }

    public static string read2(int test)
    {
        return "test";
    }
    public static string read2(parameter test)
    {
        return "test";
    }
}

lua code:

luanet.load_assembly 'D_4_0_Prototype.Test'
luanet.import_type 'D_4_0_Prototype.Test.master'
testclass = luanet.import_type 'D_4_0_Prototype.Test.testClass'
parameter = luanet.import_type 'D_4_0_Prototype.Test.parameter'
p=parameter()

result:

testclass.read2(1)   -- is working
testclass.read2(p)   -- is working
testclass.read(p)     -- is not working. it is also not working if the method in base class has two parameters instead of one
testclass.read(1)     -- is working

You will also get another error messages if you first call

testclass.read(1) 

and then

testclass.read(p)

Regards

Karsten

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