public void LoadLibrary() { LibraryBasis.Load(this); LibraryJson.Load(this); LibraryMath.Load(this); LibraryUserdata.Load(this); LibraryIO.Load(this); }
public void LoadLibrary() { LibraryBasis.Load(this); LibraryArray.Load(this); LibraryString.Load(this); LibraryTable.Load(this); LibraryJson.Load(this); LibraryMath.Load(this); }
public void LoadLibrary() { LibraryBasis.Load(this); LibraryArray.Load(this); LibraryString.Load(this); LibraryTable.Load(this); LibraryJson.Load(this); LibraryMath.Load(this); LibraryFunc.Load(this); LibraryUserdata.Load(this); LibraryIO.Load(this); }
public Script() { Global = new ScriptGlobal(); TypeObject = new ScriptTypeObject("Object"); TypeObjectValue = new ScriptValue(TypeObject); Global.SetValue(TypeObject.TypeName, TypeObjectValue); AddPrimitivePrototype("Bool", ref m_TypeBool, ref m_TypeValueBool); AddPrimitivePrototype("Number", ref m_TypeNumber, ref m_TypeValueNumber); AddPrimitivePrototype("String", ref m_TypeString, ref m_TypeValueString); AddPrimitivePrototype("Function", ref m_TypeFunction, ref m_TypeValueFunction); AddBasicPrototype(m_TypeArray = new ScriptTypeBasicArray(this, "Array", TypeObjectValue), ref m_TypeValueArray); AddBasicPrototype(m_TypeMap = new ScriptTypeBasicMap(this, "Map", TypeObjectValue), ref m_TypeValueMap); AddBasicPrototype(m_TypeStringBuilder = new ScriptTypeBasicStringBuilder(this, "StringBuilder", TypeObjectValue), ref m_TypeValueStringBuilder); Global.SetValue(GLOBAL_NAME, new ScriptValue(Global)); Global.SetValue(GLOBAL_SCRIPT, ScriptValue.CreateValue(this)); Global.SetValue(GLOBAL_VERSION, ScriptValue.CreateValue(typeof(Version))); ProtoObject.Load(this, TypeObject); ProtoBoolean.Load(this, TypeBoolean); ProtoNumber.Load(this, TypeNumber); ProtoString.Load(this, TypeString); ProtoArray.Load(this, TypeArray); ProtoMap.Load(this, TypeMap); ProtoFunction.Load(this, TypeFunction); ProtoStringBuilder.Load(this, TypeStringBuilder); TypeManager.PushAssembly(typeof(object).Assembly); //mscorlib.dll TypeManager.PushAssembly(typeof(System.Net.Sockets.Socket).Assembly); //System.dll TypeManager.PushAssembly(GetType().Assembly); //当前所在的程序集 LibraryBasis.Load(this); LibraryJson.Load(this); LibraryMath.Load(this); LibraryUserdata.Load(this); LibraryIO.Load(this); }
static void Mathtest() { LibraryMath math = new LibraryMath(); Console.WriteLine(n1 + " + " + n2 + " = " + math.Plus(n1, n2)); Console.WriteLine(n3 + " + " + n4 + " = " + math.Plus(n3, n4)); Console.WriteLine(n5 + " + " + n6 + " = " + math.Plus(n5, n6)); Console.WriteLine(n1 + " - " + n2 + " = " + math.Minus(n1, n2)); Console.WriteLine(n3 + " - " + n4 + " = " + math.Minus(n3, n4)); Console.WriteLine(n5 + " - " + n6 + " = " + math.Minus(n5, n6)); Console.WriteLine(n1 + " * " + n2 + " = " + math.Gange(n1, n2)); Console.WriteLine(n3 + " * " + n4 + " = " + math.Gange(n3, n4)); Console.WriteLine(n5 + " * " + n6 + " = " + math.Gange(n5, n6)); Console.WriteLine(n1 + " / " + n2 + " = " + math.Dividere(n1, n2)); Console.WriteLine(n3 + " / " + n4 + " = " + math.Dividere(n3, n4)); Console.WriteLine(n5 + " / " + n6 + " = " + math.Dividere(n5, n6)); Console.WriteLine(n1 + "^" + n2 + " = " + math.Potens(n1, n2)); Console.WriteLine(n3 + "^" + n4 + " = " + math.Potens(n3, n4)); Console.WriteLine(n5 + "^" + n6 + " = " + math.Potens(n5, n6)); Console.WriteLine("Kvadratroden af 64 = " + math.Kvadratrod((int)64)); Console.WriteLine("Kvadratroden af 9 = " + math.Kvadratrod((float)9)); Console.WriteLine("Kvadratroden af 625 = " + math.Kvadratrod("625")); }