From dd87d01f060cf3ff6d2f466d1910453cb03722e2 Mon Sep 17 00:00:00 2001 From: Zackhasacat Date: Fri, 3 Nov 2023 16:31:23 +0000 Subject: [PATCH] Fix minor doc error, throw error when attempting to assign a value to a non-existing global variable in lua --- apps/openmw/mwlua/mwscriptbindings.cpp | 2 +- files/lua_api/openmw/types.lua | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/openmw/mwlua/mwscriptbindings.cpp b/apps/openmw/mwlua/mwscriptbindings.cpp index 92957efb71..af88249d3e 100644 --- a/apps/openmw/mwlua/mwscriptbindings.cpp +++ b/apps/openmw/mwlua/mwscriptbindings.cpp @@ -140,7 +140,7 @@ namespace MWLua = sol::overload([](const GlobalStore& store, std::string_view globalId, float val) { auto g = store.search(ESM::RefId::deserializeText(globalId)); if (g == nullptr) - return; + throw std::runtime_error("No variable \"" + std::string(globalId) + "\" in GlobalStore"); char varType = MWBase::Environment::get().getWorld()->getGlobalVariableType(globalId); if (varType == 's' || varType == 'l') { diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index 69ce5fbaf2..9282fbffcc 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -930,7 +930,6 @@ -- Whether teleportation for this player is enabled. -- @function [parent=#Player] isTeleportingEnabled -- @param openmw.core#GameObject player --- @param #boolean player -- @return #boolean ---