From 88fbe7ca1e5451851ee0c7ab5524c39a7bb703c2 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Sun, 6 Mar 2016 14:41:26 -0500 Subject: Use LuaErrors in security check macros Throwing a LuaError calls destructors as it propagates up the stack, wheres lua_error just executes a longjmp. --- src/script/lua_api/l_util.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/script/lua_api') diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index df46925d1..98f70d917 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -77,8 +77,7 @@ int ModApiUtil::l_get_us_time(lua_State *L) #define CHECK_SECURE_SETTING(L, name) \ if (ScriptApiSecurity::isSecure(L) && \ name.compare(0, 7, "secure.") == 0) { \ - lua_pushliteral(L, "Attempt to set secure setting."); \ - lua_error(L); \ + throw LuaError("Attempt to set secure setting."); \ } // setting_set(name, value) -- cgit v1.2.3