moonsharp-devs / moonsharp

An interpreter for the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms, including handy remote debugger facilities.

Home Page:http://www.moonsharp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chaining Extension Methods only works after running the script again

EthanSK opened this issue · comments

The first time I run this

` RegisterAllExtensionMethods();

    string tempstr = @"
        local a = Vector3(0,1,2).WithX(6969).WithY(555).WithZ(666)           
        print('le vec',a)
     ";
    DynValue res = Script.DoString(tempstr);

`

It gives error ScriptRuntimeException: cannot access field WithY of userdata<UnityEngine.Vector3>

and the next time i run it in the same unity play session, I get

ScriptRuntimeException: cannot access field WithZ of userdata<UnityEngine.Vector3>

and then running it any subsequent time works.

It doesn't matter how many times I call RegisterAllExtensionMethods(), what seems to matter is how many times DoScript was called. It's like every time it runs the script, it adds to some user data a level of chaining thats supported...