Skip to content

Commit 4964b0c

Browse files
committed
Adding script parsing
1 parent 4115f5d commit 4964b0c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Molang/MolangSet.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,19 @@ export namespace MolangFullSet {
135135

136136
return false;
137137
}
138+
139+
export function fromScript(script: { variables?: Record<string, string> }, addTo: MolangSet): void {
140+
if (script.variables) {
141+
const keys = Object.getOwnPropertyNames(script.variables);
142+
143+
for (let I = 0; I < keys.length; I++) {
144+
const key = keys[I];
145+
const value = script.variables[key];
146+
147+
if (typeof key === "string" && typeof value === "string") {
148+
addTo.variables.defined.push(key);
149+
}
150+
}
151+
}
152+
}
138153
}

0 commit comments

Comments
 (0)