Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/scripting/StarRootLuaBindings.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-11-02 08:23:36 +1100
committerKae <80987908+Novaenia@users.noreply.github.com>2023-11-02 08:23:36 +1100
commitbea100bde9ccdb574c1ab207a7cd179a5063e046 (patch)
tree647a423bdd3ab31f4e2e3b7cf203a7d60f8f068c /source/game/scripting/StarRootLuaBindings.cpp
parent0497048b444056248be156c73cba694ca30a81dd (diff)
Setting a configuration value to nil should actually erase it
also configurationVersion set is already checked in Configuration
Diffstat (limited to 'source/game/scripting/StarRootLuaBindings.cpp')
-rw-r--r--source/game/scripting/StarRootLuaBindings.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/game/scripting/StarRootLuaBindings.cpp b/source/game/scripting/StarRootLuaBindings.cpp
index 6f8886e..d72748f 100644
--- a/source/game/scripting/StarRootLuaBindings.cpp
+++ b/source/game/scripting/StarRootLuaBindings.cpp
@@ -177,7 +177,7 @@ LuaCallbacks LuaBindings::makeRootCallbacks() {
});
callbacks.registerCallback("setConfiguration", [root](String const& key, Json const& value) {
- if (key == "safeScripts" || key == "configurationVersion")
+ if (key == "safeScripts")
throw StarException(strf("Cannot set {}", key));
else
root->configuration()->set(key, value);
@@ -186,14 +186,14 @@ LuaCallbacks LuaBindings::makeRootCallbacks() {
callbacks.registerCallback("getConfigurationPath", [root](String const& path) -> Json {
if (path.beginsWith("title"))
- throw StarException(strf("Cannot get {}", path));
+ throw ConfigurationException(strf("cannot get {}", path));
else
return root->configuration()->getPath(path);
});
callbacks.registerCallback("setConfigurationPath", [root](String const& path, Json const& value) {
- if (path.beginsWith("safeScripts") || path.beginsWith("configurationVersion"))
- throw StarException(strf("Cannot set {}", path));
+ if (path.beginsWith("safeScripts"))
+ throw ConfigurationException(strf("cannot set {}", path));
else
root->configuration()->setPath(path, value);
});