You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ManualDocs("sleep","{\"title\":\"sleep(ms)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"sleep(<number of miliseconds to wait>);\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Waits for \"},{\"text\":\"ms\",\"color\":\"Green\"},{\"text\":\" miliseconds.\"}]}]}")]
83
-
publicstaticvoidSleep(intms)=>Thread.Sleep(ms);
83
+
publicstaticvoidSleep(intms)
84
+
{
85
+
if(ms<0)
86
+
{
87
+
thrownewInterpreterException("sleep: Cannot sleep for a negative number of miliseconds!");
88
+
}
89
+
Thread.Sleep(ms);
90
+
}
84
91
85
92
[ManualDocs("len","{\"title\":\"len(obj)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"len(<array or string>)\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Returns the length of \"},{\"text\":\"obj\",\"color\":\"Green\"},{\"text\":\", if it is a string or an array. If not it will throw an error.\"}]}]}")]
86
93
publicstaticintLen(objectobj)
@@ -105,7 +112,7 @@ public static object[] Chars(string s)
105
112
{
106
113
if(s==null)
107
114
{
108
-
thrownewInterpreterException("chars: string passed was null!");
115
+
thrownewInterpreterException("chars: string passed in was null!");
109
116
}
110
117
returnUtils.ToArray(s.ToArray());
111
118
}
@@ -123,14 +130,18 @@ public static string _7sToString(object obj)
[ManualDocs("arrayAdd","{\"title\":\"arrayAdd(arr, value)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"arrayAdd(<array>, <value>)\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Returns \"},{\"text\":\"array\",\"color\":\"Green\"},{\"text\":\" with \"},{\"text\":\"value\",\"color\":\"Green\"},{\"text\":\" added to the end.\"}]}]}")]
[ManualDocs("arrayRemove","{\"title\":\"arrayRemove(arr, index)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"arrayAdd(<array>, <index>)\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Returns \"},{\"text\":\"array\",\"color\":\"Green\"},{\"text\":\", but the element at index \"},{\"text\":\"index\",\"color\":\"Green\"},{\"text\":\" is removed.\"}]}]}")]
thrownewInterpreterException("arrayRemove: Cannot remove from an array that is null!");
156
+
}
142
157
if(index<0||index>=arr.Length)
143
158
{
144
159
thrownewInterpreterException("Attempted to remove an element that is not in bounds of the array");
@@ -147,10 +162,24 @@ public static object[] ArrayRemove(object[] arr, int index)
147
162
}
148
163
149
164
[ManualDocs("sqrt","{\"title\":\"sqrt(x)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"sqrt(<number>);\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Takes the square root of\"},{\"text\":\"x\",\"color\":\"Green\"},{\"text\":\".\"}]}]}")]
150
-
publicstaticdoubleSqrt(doublex)=>Math.Sqrt(x);
165
+
publicstaticdoubleSqrt(doublex)
166
+
{
167
+
if(x<0)
168
+
{
169
+
thrownewInterpreterException("sqrt: Complex numbers are not supported! (Attempted to take the square root of a negative number)");
170
+
}
171
+
returnMath.Sqrt(x);
172
+
}
151
173
152
174
[ManualDocs("pow","{\"title\":\"pow(x, n)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"pow(<number>, <number>);\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Raise \"},{\"text\":\"x\",\"color\":\"Green\"},{\"text\":\" to the power of \"},{\"text\":\"n\",\"color\":\"Green\"}]}]}")]
thrownewInterpreterException("pow: Cannot raise 0 to the 0th power!");
180
+
}
181
+
returnMath.Pow(x,y);
182
+
}
154
183
155
184
[ManualDocs("fgColor","{\"title\":\"fgColor(color)\",\"sections\":[{\"header\":\"Syntax\",\"text\":[{\"text\":\"fgColor(<color number or name>);\"}]},{\"header\":\"Behavior\",\"text\":[{\"text\":\"Set the text color to \"},{\"text\":\"color\",\"color\":\"Green\"}]},{\"header\":\"Valid colors\",\"text\":[{\"text\":\"BLACK BLUE CYAN DARK_BLUE DARK_CYAN DARK_GRAY DARK_GREEN DARK_MAGENTA DARK_RED DARK_YELLOW GRAY GREEN MAGENTA RED WHITE YELLOW\",\"color\":\"Cyan\"}]}]}")]
0 commit comments