Move index_error_maker into new file (ScriptUtil.h). Add newindex_error_maker. Make them call ScriptAssert instead of just throwing an exception so it won't terminate the application on WARN or SILENT error modes.

This commit is contained in:
hispidence 2021-08-20 01:37:49 +01:00
parent 6727138e64
commit e74fa376d1
4 changed files with 17 additions and 7 deletions

View file

@ -3,13 +3,6 @@
#include <functional>
#include <string>
#define index_error_maker(CPP_TYPE, LUA_CLASS_NAME) [](CPP_TYPE & item, sol::object key) \
{ \
std::string err = "Attempted to read non-existant var \"" + key.as<std::string>() + "\" from " + LUA_CLASS_NAME; \
throw TENScriptException(err); \
}
template <typename S> using callbackSetName = std::function<bool(std::string const&, S identifier)>;
using callbackRemoveName = std::function<bool(std::string const&)>;