Throwing a LuaError calls destructors as it propagates up the stack,
wheres lua_error just executes a longjmp.
#define CHECK_SECURE_PATH(L, path) \
if (!ScriptApiSecurity::checkPath(L, path)) { \
- lua_pushstring(L, (std::string("Attempt to access external file ") + \
- path + " with mod security on.").c_str()); \
- lua_error(L); \
+ throw LuaError(std::string("Attempt to access external file ") + \
+ path + " with mod security on."); \
}
#define CHECK_SECURE_PATH_OPTIONAL(L, path) \
if (ScriptApiSecurity::isSecure(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)