#include <string_view>
#include <lua.h>
#include <lauxlib.h>
#include "config.h"
#include "common/c_types.h"
Go to the source code of this file.
Macros | |
#define | INDIRECT_SCRIPTAPI_RIDX 0 |
#define | PUSH_ERROR_HANDLER(L) (lua_rawgeti((L), LUA_REGISTRYINDEX, CUSTOM_RIDX_ERROR_HANDLER), lua_gettop((L))) |
#define | PCALL_RESL(L, RES) |
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) |
bool | script_log_unique (lua_State *L, std::string_view message, std::ostream &log_to, int stack_depth=1) |
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=1, bool once=false) |
Handles a deprecation warning based on user settings. | |
void | call_string_dump (lua_State *L, int idx) |
#define INDIRECT_SCRIPTAPI_RIDX 0 |
#define PCALL_RESL | ( | L, | |
RES ) |
Referenced by ModApiEnv::l_add_item().
#define PUSH_ERROR_HANDLER | ( | L | ) | (lua_rawgeti((L), LUA_REGISTRYINDEX, CUSTOM_RIDX_ERROR_HANDLER), lua_gettop((L))) |
Referenced by MainMenuScripting::beforeClose(), ScriptApiEnv::check_for_falling(), check_function(), ScriptApiServer::createAuth(), ScriptApiDetached::detached_inventory_AllowMove(), ScriptApiDetached::detached_inventory_AllowPut(), ScriptApiDetached::detached_inventory_AllowTake(), ScriptApiDetached::detached_inventory_OnMove(), ScriptApiDetached::detached_inventory_OnPut(), ScriptApiDetached::detached_inventory_OnTake(), ScriptApiServer::getAuth(), ScriptApiMainMenu::handleMainMenuButtons(), ScriptApiMainMenu::handleMainMenuEvent(), ScriptApiItem::item_CraftPredict(), ScriptApiItem::item_OnCraft(), ScriptApiItem::item_OnDrop(), ScriptApiItem::item_OnPlace(), ScriptApiItem::item_OnSecondaryUse(), ScriptApiItem::item_OnUse(), ModApiEnv::l_add_item(), ScriptApiBase::loadScript(), ScriptApiEntity::luaentity_Activate(), ScriptApiEntity::luaentity_Deactivate(), ScriptApiEntity::luaentity_GetStaticdata(), ScriptApiEntity::luaentity_Punch(), ScriptApiEntity::luaentity_run_simple_callback(), ScriptApiEntity::luaentity_Step(), ScriptApiNode::node_after_destruct(), ScriptApiNode::node_on_construct(), ScriptApiNode::node_on_destruct(), ScriptApiNode::node_on_dig(), ScriptApiNode::node_on_flood(), ScriptApiNode::node_on_punch(), ScriptApiNode::node_on_receive_fields(), ScriptApiNode::node_on_timer(), ScriptApiNodemeta::nodemeta_inventory_AllowMove(), ScriptApiNodemeta::nodemeta_inventory_AllowPut(), ScriptApiNodemeta::nodemeta_inventory_AllowTake(), ScriptApiNodemeta::nodemeta_inventory_OnMove(), ScriptApiNodemeta::nodemeta_inventory_OnPut(), ScriptApiNodemeta::nodemeta_inventory_OnTake(), ScriptApiServer::on_dynamic_media_added(), ScriptApiEnv::on_emerge_area_completion(), ScriptApiPlayer::on_player_hpchange(), AsyncWorkerThread::run(), ScriptApiBase::runCallbacksRaw(), ScriptApiServer::setPassword(), AsyncEngine::stepJobResults(), ScriptApiEnv::triggerABM(), and ScriptApiEnv::triggerLBM().
anonymous enum |
Enumerator | |
---|---|
CUSTOM_RIDX_BEFORE_ | |
CUSTOM_RIDX_SCRIPTAPI | |
CUSTOM_RIDX_GLOBALS_BACKUP |
|
CUSTOM_RIDX_CURRENT_MOD_NAME | |
CUSTOM_RIDX_ERROR_HANDLER | |
CUSTOM_RIDX_HTTP_API_LUA | |
CUSTOM_RIDX_METATABLE_MAP | |
CUSTOM_RIDX_READ_VECTOR | |
CUSTOM_RIDX_PUSH_VECTOR | |
CUSTOM_RIDX_READ_NODE | |
CUSTOM_RIDX_PUSH_NODE | |
CUSTOM_RIDX_PUSH_MOVERESULT1 |
enum RunCallbacksMode |
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().
bool script_log_unique | ( | lua_State * | L, |
std::string_view | message, | ||
std::ostream & | log_to, | ||
int | stack_depth = 1 ) |
References hash(), murmur_hash_64_ua(), and script_log_add_source().
Referenced by log_deprecated(), and read_hud_change().