+ mGame = game;\r
+\r
+ string[] functions = Parse.List(code);\r
+ if (functions != null)\r
+ {\r
+ foreach (string function in functions)\r
+ {\r
+ string[] parts = Parse.Function(function);\r
+ if (parts != null)\r
+ {\r
+ string[] args = Parse.List(parts[1]);\r
+ if (args != null)\r
+ {\r
+ Function func = new Function(parts[0], args);\r
+ mFunctions.Add(func);\r
+ }\r
+ else throw new Exception("Arguments could not be parsed: " + parts[1]);\r
+ }\r
+ else throw new Exception("Function could not be parsed: " + function);\r
+ }\r
+ }\r
+ else throw new Exception("Script could not be parsed: " + code);\r