#include "common/c_internal.h"
#include "cpp_api/s_security.h"
#include "util/numeric.h"
#include "debug.h"
#include "log.h"
#include "porting.h"
#include "settings.h"
#include <algorithm>
Functions | |
std::string | script_get_backtrace (lua_State *L) |
int | script_exception_wrapper (lua_State *L, lua_CFunction f) |
int | script_error_handler (lua_State *L) |
void | script_error (lua_State *L, int pcall_result, const char *mod, const char *fxn) |
static std::string | script_log_add_source (lua_State *L, std::string_view message, int stack_depth) |
bool | script_log_unique (lua_State *L, std::string_view message_in, std::ostream &log_to, int stack_depth) |
DeprecatedHandlingMode | get_deprecated_handling_mode () |
Reads deprecated_lua_api_handling in settings, returns cached value. | |
void | log_deprecated (lua_State *L, std::string_view message, int stack_depth, bool once) |
Handles a deprecation warning based on user settings. | |
void | call_string_dump (lua_State *L, int idx) |
void call_string_dump | ( | lua_State * | L, |
int | idx ) |
References ScriptApiSecurity::getGlobalsBackup(), and idx.
Referenced by ModApiMainMenu::l_do_async_callback(), ModApiServer::l_do_async_callback(), and pack_inner().
DeprecatedHandlingMode get_deprecated_handling_mode | ( | ) |
Reads deprecated_lua_api_handling
in settings, returns cached value.
References Error, g_settings, Settings::get(), Ignore, and Log.
Referenced by ModSpec::checkAndLog(), SubgameSpec::checkAndLog(), ModApiBase::l_deprecated_function(), and log_deprecated().
void log_deprecated | ( | lua_State * | L, |
std::string_view | message, | ||
int | stack_depth = 1, | ||
bool | once = false ) |
Handles a deprecation warning based on user settings.
L | Lua State |
message | The deprecation method |
stack_depth | How far on the stack to the first user function (ie: not builtin or core). -1 to disabled. |
once | Log the deprecation warning only once per callsite. |
References Error, get_deprecated_handling_mode(), Ignore, infostream, script_get_backtrace(), script_log_add_source(), script_log_unique(), and warningstream.
Referenced by ScriptApiSecurity::checkPathWithGamedef(), get_compress_method(), ModApiParticles::l_add_particle(), ModApiParticles::l_add_particlespawner(), LuaVoxelManip::l_calc_lighting(), ObjectRef::l_get_attribute(), ObjectRef::l_get_bone_position(), ModApiEnv::l_get_connected_players(), ObjectRef::l_get_entity_name(), ObjectRef::l_get_look_pitch(), ObjectRef::l_get_look_yaw(), ModApiMapgen::l_get_mapgen_params(), LuaItemStack::l_get_metadata(), ObjectRef::l_get_sky(), ObjectRef::l_get_sky_color(), ModApiUtil::l_log(), ModApiMapgen::l_register_ore(), ObjectRef::l_set_attribute(), ObjectRef::l_set_bone_position(), LuaVoxelManip::l_set_lighting(), ObjectRef::l_set_look_pitch(), ObjectRef::l_set_look_yaw(), ModApiMapgen::l_set_mapgen_params(), LuaItemStack::l_set_metadata(), ObjectRef::l_set_sky(), MetaDataRef::l_set_string(), LuaVoxelManip::l_was_modified(), ScriptApiEntity::logDeprecationForExistingProperties(), and read_hud_element().
void script_error | ( | lua_State * | L, |
int | pcall_result, | ||
const char * | mod, | ||
const char * | fxn ) |
References itos(), and porting::mt_snprintf().
Referenced by ScriptApiBase::scriptError(), and AsyncEngine::stepJobResults().
int script_error_handler | ( | lua_State * | L | ) |
int script_exception_wrapper | ( | lua_State * | L, |
lua_CFunction | f ) |
References debug_describe_exc().
Referenced by ScriptApiBase::ScriptApiBase().
std::string script_get_backtrace | ( | lua_State * | L | ) |
Referenced by check_field_or_nil(), checkSettingSecurity(), ModApiServer::l_chat_send_all(), ModApiServer::l_chat_send_player(), ObjectRef::l_set_armor_groups(), log_deprecated(), read_tool_capabilities(), ScriptApiBase::realityCheck(), and warn_if_field_exists().
|
staticnodiscard |
References FATAL_ERROR_IF.
Referenced by log_deprecated(), and script_log_unique().
bool script_log_unique | ( | lua_State * | L, |
std::string_view | message_in, | ||
std::ostream & | log_to, | ||
int | stack_depth ) |
References hash(), murmur_hash_64_ua(), and script_log_add_source().
Referenced by log_deprecated(), and read_hud_change().