Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Notation ":" to invoke method in Lua #518

Open
genis-cats opened this issue Jan 15, 2024 · 0 comments
Open

Change Notation ":" to invoke method in Lua #518

genis-cats opened this issue Jan 15, 2024 · 0 comments

Comments

@genis-cats
Copy link

Hello!

I'd like to know the way to change from notation ":" of invokation method c# function to notation .

`

internal class Program
{
    static void Main(string[] args)
    {
        using (Lua lua = new Lua())
        {
            lua.State.Encoding = Encoding.UTF8;
            lua["Example"] = new SomeClass();
            lua.DoString("res = Example.Func1()"); // : -> . 
            double res = (double)lua["res"];


            Console.WriteLine(res);
        }
    }
}

public class SomeClass
{
    public string MyProperty { get; private set; }

    public SomeClass(string param1 = "defaulValue")
    {
        MyProperty = param1;
    }

    public int Func1()
    {
        return 32;
    }

    public string AnotherFunc(int val1, string val2)
    {
        return "Some String";
    }

    public static string StaticMethod(int param)
    {
        return "Return of Static Method";
    }
}

`

I tried to change this code for that but seesm not easy..

{
// Format for easy method invocation
    string command = path + "." + name + "("; // change : -> .

    if (method.GetParameters().Length == 0)
    command += ")";
    _globals.Add(command);
}

Is there any option to change notation in Nlua?

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

No branches or pull requests

1 participant