mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-10 20:46:47 +03:00
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:
parent
6727138e64
commit
e74fa376d1
4 changed files with 17 additions and 7 deletions
13
TR5Main/Scripting/ScriptUtil.h
Normal file
13
TR5Main/Scripting/ScriptUtil.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
#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; \
|
||||
ScriptAssert(false, err);\
|
||||
}
|
||||
|
||||
#define newindex_error_maker(CPP_TYPE, LUA_CLASS_NAME) [](CPP_TYPE & item, sol::object key) \
|
||||
{ \
|
||||
std::string err = "Attempted to set non-existant var \"" + key.as<std::string>() + "\" of " + LUA_CLASS_NAME; \
|
||||
ScriptAssert(false, err);\
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue