From dd2630579bfff727c11de831998aac8f6f6d168f Mon Sep 17 00:00:00 2001 From: gnembon Date: Wed, 20 Nov 2019 23:37:16 -0400 Subject: [PATCH] built-in variables can be used in outer scopes. --- src/main/java/carpet/script/value/GlobalValue.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/carpet/script/value/GlobalValue.java b/src/main/java/carpet/script/value/GlobalValue.java index bd585eda..697d630d 100644 --- a/src/main/java/carpet/script/value/GlobalValue.java +++ b/src/main/java/carpet/script/value/GlobalValue.java @@ -1,10 +1,13 @@ package carpet.script.value; +import carpet.script.exception.InternalExpressionException; + public class GlobalValue extends Value { public GlobalValue(Value variable) { - variable.assertAssignable(); + if (variable.boundVariable == null) + throw new InternalExpressionException("You can only borrow variables from the outer scope"); this.boundVariable = variable.boundVariable; }