#include <helper.h>
Public Member Functions | |
| template<> | |
| bool | readParam (lua_State *L, int index) |
| template<> | |
| s16 | readParam (lua_State *L, int index) |
| template<> | |
| int | readParam (lua_State *L, int index) |
| template<> | |
| float | readParam (lua_State *L, int index) |
| template<> | |
| v2s16 | readParam (lua_State *L, int index) |
| template<> | |
| v2f | readParam (lua_State *L, int index) |
| template<> | |
| v3f | readParam (lua_State *L, int index) |
| template<> | |
| std::string_view | readParam (lua_State *L, int index) |
| template<> | |
| std::string | readParam (lua_State *L, int index) |
| template<> | |
| std::string_view | readParam (lua_State *L, int index) |
| Read a string from Lua state L at index without copying it. | |
Static Public Member Functions | |
| static bool | geti (lua_State *L, int table, int i) |
| Utility for list iteration. | |
| template<typename F> | |
| static void | for_ipairs (lua_State *L, int table, const F &f) |
| Iterate values t[1], t[2], ... of the given table in order. | |
Static Protected Member Functions | |
| template<typename T> | |
| static T | readParam (lua_State *L, int index) |
| Read a value using a template type T from Lua state L at index. | |
| template<typename T> | |
| static T | readParam (lua_State *L, int index, const T &default_value) |
| Read a value using a template type T from Lua state L at index. | |
|
inlinestatic |
Iterate values t[1], t[2], ... of the given table in order.
Iterates up to the first nil value, similar to ipairs in Lua. Values will be left on the stack for f(). f() must leave the stack level unchanged.
| table | Lua stack (pseudo-)index of table |
| f | Function (typically lambda) to be called for each value. |
Referenced by ModApiEnvBase::collectNodeIds(), get_biome_list(), ModApiMapgen::l_create_schematic(), NodeMetaRef::l_mark_as_private(), ModApiMapgen::l_set_gen_notify(), ObjectRef::l_set_minimap_modes(), ObjectRef::l_set_sky(), read_content_features(), ModApiHttp::read_http_fetch_request(), ScriptApiEnv::read_nodenames(), read_object_properties(), read_schematic_def(), and read_stringlist().
|
inlinestatic |
Utility for list iteration.
Usage:
| table | index of the table t on the stack |
| i | integer to index table with |
References table.
Referenced by for_ipairs(), read_content_features(), ModApiCraft::readCraftRecipeShaped(), and ModApiCraft::readCraftRecipeShapeless().
| std::string LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
| std::string_view LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
| v3f LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
| v2f LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
| v2s16 LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
| float LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
| int LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
| s16 LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
| bool LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
| std::string_view LuaHelper::readParam | ( | lua_State * | L, |
| int | index ) |
Read a string from Lua state L at index without copying it.
Note that the returned string view is only valid as long as the value is on the stack and has not been modified. Be careful.
| L | Lua state |
| index | Lua index to read |
|
staticprotected |
Read a value using a template type T from Lua state L at index.
| T | type to read from Lua |
| L | Lua state |
| index | Lua index to read |
Referenced by ModApiEnvBase::collectNodeIds(), LuaAreaStore::create_object(), LuaRaycast::create_object(), LuaValueNoise::create_object(), ModApiMainMenu::getBoolData(), ScriptApiBase::getCurrentModNameInsecure(), MetaDataRef::handleFromTable(), ModApiEnv::l_add_entity(), ModApiParticles::l_add_particle(), ModApiParticles::l_add_particlespawner(), ModApiParticlesLocal::l_add_particlespawner(), LuaItemStack::l_add_wear_by_uses(), LuaValueNoiseMap::l_calc_2d_map(), LuaVoxelManip::l_calc_lighting(), ModApiUtil::l_compress(), InvRef::l_contains_item(), ModApiMainMenu::l_copy_dir(), ModApiInventory::l_create_detached_inventory_raw(), ModApiUtil::l_decode_base64(), ModApiUtil::l_decompress(), ModApiServer::l_disconnect_player(), ModApiAsync::l_do_async_callback(), ModApiServer::l_dynamic_add_media(), ModApiUtil::l_encode_base64(), ModApiUtil::l_encode_png(), ClientSoundHandle::l_fade(), ModApiEnv::l_find_node_near(), ModApiEnvVM::l_find_node_near(), ModApiEnv::l_find_nodes_in_area(), ModApiEnvVM::l_find_nodes_in_area(), ModApiMapgen::l_generate_decorations(), LuaValueNoise::l_get_2d(), LuaValueNoiseMap::l_get_2d_map(), LuaValueNoiseMap::l_get_2d_map_flat(), LuaAreaStore::l_get_areas_in_area(), ObjectRef::l_get_bone_override(), ObjectRef::l_get_bone_position(), LuaSettings::l_get_bool(), ModApiUtil::l_get_dig_params(), ModApiUtil::l_get_dir_list(), ModApiUtil::l_get_hit_params(), ModApiClient::l_get_item_def(), ModApiMainMenu::l_get_mapgen_names(), ModApiStorage::l_get_mod_storage(), ModApiServer::l_get_modnames(), ModApiClient::l_get_modpath(), ModApiClient::l_get_node_def(), ModApiEnv::l_get_objects_inside_radius(), ObjectRef::l_get_sky(), ModApiUtil::l_get_tool_wear_after_use(), ModApiEnv::l_get_value_noise(), ObjectRef::l_hud_set_hotbar_image(), ObjectRef::l_hud_set_hotbar_selected_image(), ModApiIPC::l_ipc_cas(), ModApiIPC::l_ipc_get(), ModApiIPC::l_ipc_poll(), ModApiIPC::l_ipc_set(), ModApiUtil::l_is_valid_player_name(), ModApiUtil::l_is_yes(), ModApiUtil::l_log(), NodeMetaRef::l_mark_as_private(), ObjectRef::l_move_to(), ModApiServer::l_notify_authentication_modified(), ObjectRef::l_override_day_night_ratio(), ModApiUtil::l_parse_json(), ModApiMapgen::l_place_schematic(), ModApiMapgen::l_place_schematic_on_vmanip(), ObjectRef::l_punch(), ModApiServer::l_register_async_dofile(), ModApiServer::l_register_mapgen_script(), InvRef::l_remove_item(), ModApiServer::l_request_shutdown(), ModApiUtil::l_rmdir(), ModApiUtil::l_safe_file_write(), ModApiMapgen::l_save_gen_notify(), ModApiMapgen::l_serialize_schematic(), NodeTimerRef::l_set(), ObjectRef::l_set_animation(), ObjectRef::l_set_animation_frame_speed(), ObjectRef::l_set_attach(), ModApiMainMenu::l_set_background(), ObjectRef::l_set_bone_override(), ObjectRef::l_set_bone_position(), LuaSettings::l_set_bool(), ModApiMainMenu::l_set_clouds(), ModApiMainMenu::l_set_clouds_color(), ObjectRef::l_set_eye_offset(), ObjectRef::l_set_formspec_prepend(), ObjectRef::l_set_fov(), ModApiMapgen::l_set_gen_notify(), ObjectRef::l_set_hp(), ObjectRef::l_set_inventory_formspec(), ObjectRef::l_set_local_animation(), ObjectRef::l_set_look_horizontal(), ObjectRef::l_set_look_pitch(), ObjectRef::l_set_look_vertical(), ObjectRef::l_set_look_yaw(), ModApiMapgen::l_set_mapgen_params(), ModApiMapgen::l_set_mapgen_setting(), ModApiMapgen::l_set_mapgen_setting_noiseparams(), ObjectRef::l_set_minimap_modes(), ModApiMapgen::l_set_noiseparams(), ObjectRef::l_set_observers(), ObjectRef::l_set_sky(), ModApiMainMenu::l_set_sky_color(), ObjectRef::l_set_sprite(), LuaPcgRandom::l_set_state(), MetaDataRef::l_set_string(), ObjectRef::l_set_texture_mod(), ModApiEnv::l_set_timeofday(), ObjectRef::l_set_wielded_item(), ObjectRef::l_set_yaw(), ModApiUtil::l_sha1(), ModApiUtil::l_sha256(), ModApiMainMenu::l_show_path_select_dialog(), ModApiServer::l_sound_fade(), ModApiMainMenuSound::l_sound_play(), ModApiServer::l_sound_play(), NodeTimerRef::l_start(), ModApiUtil::l_strip_escapes(), ModApiUtil::l_urlencode(), ModApiUtil::l_write_json(), LuaVoxelManip::l_write_to_map(), ScriptApiEntity::luaentity_Punch(), ScriptApiEntity::luaentity_run_simple_callback(), ScriptApiBase::luaPanic(), ScriptApiNode::node_on_flood(), ScriptApiNode::node_on_timer(), ScriptApiServer::on_chat_message(), ScriptApiClientCommon::on_formspec_input(), ScriptApiClient::on_inventory_open(), ScriptApiClient::on_item_use(), ScriptApiClient::on_placenode(), ScriptApiPlayer::on_prejoinplayer(), ScriptApiClient::on_punchnode(), ScriptApiPlayer::on_punchplayer(), ScriptApiClient::on_receiving_message(), ScriptApiPlayer::on_respawnplayer(), ScriptApiClient::on_sending_message(), ModApiHttp::read_http_fetch_request(), ScriptApiEnv::read_nodenames(), ModApiCraft::readCraftRecipeShaped(), ModApiCraft::readCraftRecipeShapeless(), ModApiCraft::readCraftReplacements(), readParam(), readParam(), ScriptApiServer::readPrivileges(), ScriptApiSecurity::sl_g_loadfile(), ScriptApiBase::stackDump(), and TestScriptApi::testReadParamFloat().
|
inlinestaticprotected |
Read a value using a template type T from Lua state L at index.
| T | type to read from Lua |
| L | Lua state |
| index | Lua index to read |
| default_value | default value to apply if nil |
References readParam().