Important Jint 2.2 update was merged today

Discussion in 'News & Announcements' started by mikec, Jul 21, 2014.

By mikec on Jul 21, 2014 at 7:49 PM
  1. mikec

    mikec Master Of All That I Survey Administrator

    Jul 12, 2014
    Likes Received:
    The next release of Fougerite will contain Jint 2.2, a significant upgrade from Jint 0.9. I have merged the Jint2 branch I had been working on. It's ready for everyone else to start testing.

    Most plugins will work without any changes under the new Jint.
    Plugins that use classes in namespace outside of System will have to use a new global method.

    var Rust = importNamespace("Rust");
    Rust.Notice.Inventory(Player, txt)
    var UnityEngine = importNamespace("UnityEngine");
    var distance = UnityEngine.Vector3.Distance(vec1, vec2);

    Passing returns from C# to out variables doesn't work in Jint 2. The only Fougerite method affected is Util.TryFindType. I added a new method Util.TryFindReturnType which returns the Type directly, instead of passing to an out variable.

    There are some Javascript errors which do not cause an exception, but fail silently. Sometimes automatic casting of a C# object to string in a Javascript statement will silently fail. The script will stop as if an exception occurred, but there is no error. So far, every one of these issues I have found was solved by adding .ToString() to the C# object in a string context.

    All arrays, whether Javascript or C#, have a lower case .length property. This affects the args parameter passed to On_Command. Strings have lower case .toString() for Javascript strings, and .ToString() for C# strings. Most of the time, you do not need to invoke either form. Use something as a string, it is cast to string as expected, with few exceptions as already noted.
    • Useful Useful x 2
    • Like Like x 1


Discussion in 'News & Announcements' started by mikec, Jul 21, 2014.

Share This Page