1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Use LuaErrors in security check macros

Throwing a LuaError calls destructors as it propagates up the stack,
wheres lua_error just executes a longjmp.
This commit is contained in:
ShadowNinja 2016-03-06 14:41:26 -05:00
parent 04e311a36d
commit 88fbe7ca1e
2 changed files with 3 additions and 5 deletions

View file

@ -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)