Fougerite + Jint 2.2
Magma + Jint 0.9
Arrays always have .length property, never .Length
Only Javascript arrays have .length, C# arrays have .Length
C# method .ToString() works only if C# object has that method.ToString() and .toString() are faked for any object
Javascript method .toString() works on Javascript objects that have the method.toString() and .ToString() are faked for any object
Type conversion to string in a string context works like it should in Javascript, without calling .ToString()Type conversion is hit or miss, with many workarounds existing
Comparisons of values to null behave correctly, whether C# null or Javascript nullComparisions of values to C# null sometimes work and sometimes do not
Javascript typeof identifies C# objects with the corresponding Javascript types. string=string, function=function, number=number, and so on.
Javascript typeof always reports "object" for any C# object of any kind.
Only nullable C# types can ever == null. "obj != null" is always true for most objects referenced by plugins. It is rarely necessary to check "if(obj != null)".
Any C# type, property, or method could have a null value, whether or not it could have a null value in C#
The loop expression "for(var x in obj)" does not enumerate properties of C# objects except for arrays and one-dimensional lists. Var "x" refers to the index of the property, and the property is accessed as "obj[x]".
The loop expression "for(var i in obj)" enumerates properties of C# objects in the same way as the C# foreach loop, and the property reference is returned to "i", not the index.
Y0u can call the enumerator for C# classes, such as a Dictionary, instead of the "for...in" loop.
You can do what with what?
You can call any generic class by passing the type.
You could call some generic classes by using the non-standard notation {type} to pass the type.
The new operator works, and can instantiate C# classes or Javascript objects. Fougerite does not edit plugin scripts, except to add Magma compatibility to the global namespace.
The new operator is edited out of scripts by Magma as they are loaded, and replaced with a call to one of Magma's Util.GetInstance methods. It often called the wrong GetInstance method. The only plugin I know of where this works is Drop++.
Namespaces other than System are imported into Javascript with a global Javascript method.
Classes in all namespaces can be referenced with the full path.
Access for Javascript to C# types is given by loading the Assembly with that type into the Engine at runtime.
All C# types in any Assembly in the execution context can be accessed from Javascript.
Assigning a value to a identifier that has not been declared with var attaches that identifier to the Global object, like it does in real Javascript.
Any reference to an undeclared identifier throws an exception.
"Primitive" types - string, integer, boolean - passed to your hooks are Javascript primitives with Javascript properties and methods. That includes arrays."Primitive" types passed from C# are C# value types, with C# properties and methods.
Last edited: