added strict configuration

This commit is contained in:
gnembon committed 2022-02-01 01:25:19 +01:00
1 parent 0f9d2f6d5b
commit 893c3b984f
2 files changed
+4

No files matched your search

@@ -100,6 +100,7 @@ public class CarpetScriptHost extends ScriptHost
else if (parent != null)
{
persistenceRequired = ((CarpetScriptHost)parent).persistenceRequired;
strict = parent.strict;
}
appConfig = config;
appArgTypes = argTypes;
@@ -306,6 +307,7 @@ public class CarpetScriptHost extends ScriptHost
Map<Value, Value> config = ((MapValue) ret).getMap();
setPerPlayer(config.getOrDefault(new StringValue("scope"), new StringValue("player")).getString().equalsIgnoreCase("player"));
persistenceRequired = config.getOrDefault(new StringValue("stay_loaded"), Value.TRUE).getBoolean();
strict = config.getOrDefault(StringValue.of("strict"), Value.FALSE).getBoolean();
// check requires
Value loadRequirements = config.get(new StringValue("requires"));
if (loadRequirements instanceof FunctionValue)
@@ -36,6 +36,7 @@ public abstract class ScriptHost
private final Map<Value, ThreadPoolExecutor> executorServices = new HashMap<>();
private final Map<Value, Object> locks = new ConcurrentHashMap<>();
protected boolean inTermination = false;
public boolean strict;
private final Set<String> deprecations = new HashSet<>();
@@ -118,6 +119,7 @@ public abstract class ScriptHost
this.main = code;
this.perUser = perUser;
this.user = null;
this.strict = false;
ModuleData moduleData = new ModuleData(code);
initializeModuleGlobals(moduleData);
this.moduleData.put(code, moduleData);