aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/Scripting.ts
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-09 11:44:01 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-09 11:44:01 -0500
commit1d3a18b53942d21ab5ceb5c5c5dc836e45f1c5b6 (patch)
tree1e1a37b9ea3cb2380278a298cb35e6939cc99cb2 /src/client/util/Scripting.ts
parentbdec227a1a7498e74388434fa5a7deda9974bd8c (diff)
typing bug bix
Diffstat (limited to 'src/client/util/Scripting.ts')
-rw-r--r--src/client/util/Scripting.ts42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/client/util/Scripting.ts b/src/client/util/Scripting.ts
index 16012eb5a..237027c03 100644
--- a/src/client/util/Scripting.ts
+++ b/src/client/util/Scripting.ts
@@ -50,36 +50,36 @@ export namespace Scripting {
export function addGlobal(global: { name: string }): void;
export function addGlobal(name: string, global: any): void;
- export function addGlobal(global: { name: string }, decription?: string, params?: any): void;
- export function addGlobal(global: { name: string }, decription?: string, params?: any, name?: any): void;
+ export function addGlobal(global: { name: string }, decription?: string, params?: string): void;
+ export function addGlobal(global: { name: string }, decription?: string, params?: string, name?: string): void;
- export function addGlobal(nameOrGlobal: any, global?: any, params?: any, name?: any) {
+ export function addGlobal(first: any, second?: any, third?: string, fourth?: string) {
let n: any;
let obj: any;
- if (global !== undefined) {
- if (typeof nameOrGlobal === "string") {
- n = nameOrGlobal;
- obj = global;
+ if (second !== undefined) {
+ if (typeof first === "string") {
+ n = first;
+ obj = second;
} else {
- obj = [nameOrGlobal];
- obj.push(global);
- if (params) {
- if (params.indexOf("(") > 0) {
- obj.push(params);
- } else {
- n = params;
- }
+ obj = [first];
+ obj.push(second);
+ if (third) {
+ //if (third.indexOf("(") > 0) {
+ obj.push(third);
+ //} else {
+ //n = third;
+ //}
}
- if (name) {
- n = name;
+ if (fourth) {
+ n = fourth;
} else {
- n = nameOrGlobal.name;
+ n = first.name;
}
}
- } else if (nameOrGlobal && typeof nameOrGlobal.name === "string") {
- n = nameOrGlobal.name;
- obj = nameOrGlobal;
+ } else if (first && typeof first.name === "string") {
+ n = first.name;
+ obj = first;
} else {
throw new Error("Must either register an object with a name, or give a name and an object");
}