Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
c_converter.h File Reference
#include <vector>
#include <string_view>
#include "irrlichttypes_bloated.h"
#include "common/c_types.h"
#include <lua.h>
+ Include dependency graph for c_converter.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

std::string getstringfield_default (lua_State *L, int table, const char *fieldname, const std::string &default_)
 
bool getboolfield_default (lua_State *L, int table, const char *fieldname, bool default_)
 
float getfloatfield_default (lua_State *L, int table, const char *fieldname, float default_)
 
int getintfield_default (lua_State *L, int table, const char *fieldname, int default_)
 
bool check_field_or_nil (lua_State *L, int index, int type, const char *fieldname)
 
template<typename T >
bool getintfield (lua_State *L, int table, const char *fieldname, T &result)
 
v3s16 getv3s16field_default (lua_State *L, int table, const char *fieldname, v3s16 default_)
 
bool getstringfield (lua_State *L, int table, const char *fieldname, std::string &result)
 
bool getstringfield (lua_State *L, int table, const char *fieldname, std::string_view &result)
 
size_t getstringlistfield (lua_State *L, int table, const char *fieldname, std::vector< std::string > *result)
 
bool getboolfield (lua_State *L, int table, const char *fieldname, bool &result)
 
bool getfloatfield (lua_State *L, int table, const char *fieldname, float &result)
 
void setstringfield (lua_State *L, int table, const char *fieldname, const std::string &value)
 
void setintfield (lua_State *L, int table, const char *fieldname, int value)
 
void setfloatfield (lua_State *L, int table, const char *fieldname, float value)
 
void setboolfield (lua_State *L, int table, const char *fieldname, bool value)
 
v3f checkFloatPos (lua_State *L, int index)
 
v2f check_v2f (lua_State *L, int index)
 
v3f check_v3f (lua_State *L, int index)
 
v3s16 check_v3s16 (lua_State *L, int index)
 
v3f read_v3f (lua_State *L, int index)
 
v2f read_v2f (lua_State *L, int index)
 
v2s16 read_v2s16 (lua_State *L, int index)
 
v2s32 read_v2s32 (lua_State *L, int index)
 
video::SColor read_ARGB8 (lua_State *L, int index)
 
bool read_color (lua_State *L, int index, video::SColor *color)
 
bool is_color_table (lua_State *L, int index)
 
aabb3f read_aabb3f (lua_State *L, int index, f32 scale)
 
v3s16 read_v3s16 (lua_State *L, int index)
 
std::vector< aabb3fread_aabb3f_vector (lua_State *L, int index, f32 scale)
 
size_t read_stringlist (lua_State *L, int index, std::vector< std::string > *result)
 
void push_v2s16 (lua_State *L, v2s16 p)
 
void push_v2s32 (lua_State *L, v2s32 p)
 
void push_v2u32 (lua_State *L, v2u32 p)
 
void push_v3s16 (lua_State *L, v3s16 p)
 
void push_aabb3f (lua_State *L, aabb3f box, f32 divisor=1.0f)
 
void push_ARGB8 (lua_State *L, video::SColor color)
 
void pushFloatPos (lua_State *L, v3f p)
 
void push_v3f (lua_State *L, v3f p)
 
void push_v2f (lua_State *L, v2f p)
 
void push_aabb3f_vector (lua_State *L, const std::vector< aabb3f > &boxes, f32 divisor=1.0f)
 
void warn_if_field_exists (lua_State *L, int table, const char *fieldname, std::string_view name, std::string_view message)
 
size_t write_array_slice_float (lua_State *L, int table_index, float *data, v3u16 data_size, v3u16 slice_offset, v3u16 slice_size)
 
lua_Number hash_node_position (v3s16 pos)
 

Function Documentation

◆ check_field_or_nil()

bool check_field_or_nil ( lua_State * L,
int index,
int type,
const char * fieldname )

References errorstream, hash(), murmur_hash_64_ua(), and script_get_backtrace().

Referenced by getboolfield(), getfloatfield(), getintfield(), getstringfield(), read_content_features(), and read_wear_bar_params().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_v2f()

v2f check_v2f ( lua_State * L,
int index )

References CHECK_FLOAT, CHECK_POS_COORD, CHECK_POS_TAB, and p().

Referenced by LuaParticleParams::readLuaValue(), and LuaHelper::readParam().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_v3f()

v3f check_v3f ( lua_State * L,
int index )

References CHECK_POS_COORD, and read_v3_aux().

Referenced by checkFloatPos(), ModApiParticles::l_add_particle(), ModApiParticlesLocal::l_add_particle(), ModApiParticles::l_add_particlespawner(), LuaPerlinNoiseMap::l_calc_3d_map(), LuaPerlinNoise::l_get_3d(), LuaPerlinNoiseMap::l_get_3d_map(), LuaPerlinNoiseMap::l_get_3d_map_flat(), ObjectRef::l_set_bone_override(), ObjectRef::l_set_bone_position(), ObjectRef::l_set_rotation(), read_item_definition(), LuaParticleParams::readLuaValue(), and LuaHelper::readParam().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_v3s16()

◆ checkFloatPos()

v3f checkFloatPos ( lua_State * L,
int index )

References BS, and check_v3f().

Referenced by LuaRaycast::create_object(), ModApiEnv::l_add_entity(), ObjectRef::l_add_pos(), ObjectRef::l_add_velocity(), ModApiEnv::l_get_objects_inside_radius(), ModApiEnv::l_line_of_sight(), ObjectRef::l_move_to(), ObjectRef::l_set_acceleration(), ObjectRef::l_set_pos(), and ObjectRef::l_set_velocity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getboolfield()

bool getboolfield ( lua_State * L,
int table,
const char * fieldname,
bool & result )

References check_field_or_nil(), and table.

Referenced by getboolfield_default(), ModApiServer::l_dynamic_add_media(), ObjectRef::l_hud_set_flags(), ObjectRef::l_set_physics_override(), ModApiClientSound::l_sound_play(), read_content_features(), read_flags_table(), read_item_definition(), read_object_properties(), read_server_sound_params(), read_tree_def(), and ScriptApiEnv::readABMs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getboolfield_default()

bool getboolfield_default ( lua_State * L,
int table,
const char * fieldname,
bool default_ )

References getboolfield(), and table.

Referenced by ModApiParticles::l_add_particle(), ModApiParticlesLocal::l_add_particle(), ModApiParticles::l_add_particlespawner(), ModApiParticlesLocal::l_add_particlespawner(), ModApiMapgen::l_serialize_schematic(), LuaAreaStore::l_set_cache_params(), ObjectRef::l_set_flags(), ObjectRef::l_set_moon(), ObjectRef::l_set_sky(), ObjectRef::l_set_stars(), ObjectRef::l_set_sun(), ModApiHttp::read_http_fetch_request(), read_schematic_def(), read_tiledef(), and ScriptApiEnv::readLBMs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getfloatfield()

bool getfloatfield ( lua_State * L,
int table,
const char * fieldname,
float & result )

References check_field_or_nil(), and table.

Referenced by getfloatfield_default(), ModApiMapgen::l_register_ore(), ObjectRef::l_set_lighting(), ObjectRef::l_set_physics_override(), ModApiClientSound::l_sound_play(), read_animation_definition(), read_content_features(), read_noiseparams(), read_object_properties(), read_server_sound_params(), read_simplesoundspec(), read_tool_capabilities(), and ScriptApiEnv::readABMs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getfloatfield_default()

float getfloatfield_default ( lua_State * L,
int table,
const char * fieldname,
float default_ )

References getfloatfield(), and table.

Referenced by ModApiParticles::l_add_particle(), ModApiParticlesLocal::l_add_particle(), ModApiParticles::l_add_particlespawner(), ModApiParticlesLocal::l_add_particlespawner(), ModApiCraft::l_register_craft(), ModApiMapgen::l_register_decoration(), ModApiMapgen::l_register_ore(), ObjectRef::l_set_clouds(), ObjectRef::l_set_lighting(), ObjectRef::l_set_moon(), ObjectRef::l_set_sky(), ObjectRef::l_set_stars(), ObjectRef::l_set_sun(), read_animation_definition(), read_biome_def(), read_item_definition(), and read_server_sound_params().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getintfield()

template<typename T >
bool getintfield ( lua_State * L,
int table,
const char * fieldname,
T & result )

References check_field_or_nil(), and table.

Referenced by ScriptApiServer::getAuth(), getintfield_default(), getv3intfield(), ModApiAuth::l_auth_create(), ModApiAuth::l_auth_save(), ModApiMapgen::l_register_ore(), read_animation_definition(), read_biome_def(), ModApiHttp::read_http_fetch_request(), read_item_definition(), read_noiseparams(), read_object_properties(), read_schematic_def(), read_tool_capabilities(), read_tree_def(), and ScriptApiEnv::readABMs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getintfield_default()

int getintfield_default ( lua_State * L,
int table,
const char * fieldname,
int default_ )

◆ getstringfield() [1/2]

bool getstringfield ( lua_State * L,
int table,
const char * fieldname,
std::string & result )

References getstringfield(), and table.

Referenced by ScriptApiServer::getAuth(), getstringfield(), getstringfield_default(), ModApiAuth::l_auth_create(), ModApiAuth::l_auth_save(), ModApiServer::l_dynamic_add_media(), read_content_features(), ModApiHttp::read_http_fetch_request(), read_hud_element(), read_item_definition(), read_object_properties(), read_schematic_def(), read_server_sound_params(), read_simplesoundspec(), read_tiledef(), read_tree_def(), and ScriptApiEnv::readLBMs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getstringfield() [2/2]

bool getstringfield ( lua_State * L,
int table,
const char * fieldname,
std::string_view & result )

References check_field_or_nil(), and table.

+ Here is the call graph for this function:

◆ getstringfield_default()

std::string getstringfield_default ( lua_State * L,
int table,
const char * fieldname,
const std::string & default_ )

References getstringfield(), and table.

Referenced by getenumfield(), ModApiParticles::l_add_particle(), ModApiParticles::l_add_particlespawner(), ModApiCraft::l_clear_craft(), ModApiCraft::l_get_craft_result(), ModApiMapgen::l_read_schematic(), ModApiCraft::l_register_craft(), ModApiMapgen::l_register_decoration(), ModApiMapgen::l_register_ore(), ObjectRef::l_set_minimap_modes(), ObjectRef::l_set_moon(), ObjectRef::l_set_nametag_attributes(), ObjectRef::l_set_sun(), read_biome_def(), ModApiHttp::read_http_fetch_request(), read_hud_element(), read_item(), and ScriptApiBase::setOriginFromTableRaw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getstringlistfield()

size_t getstringlistfield ( lua_State * L,
int table,
const char * fieldname,
std::vector< std::string > * result )

References read_stringlist(), and table.

Referenced by ModApiMapgen::l_register_decoration(), ModApiMapgen::l_register_ore(), read_biome_def(), and read_deco_simple().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getv3s16field_default()

v3s16 getv3s16field_default ( lua_State * L,
int table,
const char * fieldname,
v3s16 default_ )

References getv3intfield(), and table.

Referenced by read_biome_def().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hash_node_position()

lua_Number hash_node_position ( v3s16 pos)
inline

Referenced by ScriptApiEnv::on_mapblocks_changed().

+ Here is the caller graph for this function:

◆ is_color_table()

bool is_color_table ( lua_State * L,
int index )

References is_color_table().

Referenced by is_color_table(), and ObjectRef::l_set_sky().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_aabb3f()

void push_aabb3f ( lua_State * L,
aabb3f box,
f32 divisor = 1.0f )

Referenced by push_aabb3f_vector(), push_nodebox(), and push_object_properties().

+ Here is the caller graph for this function:

◆ push_aabb3f_vector()

void push_aabb3f_vector ( lua_State * L,
const std::vector< aabb3f > & boxes,
f32 divisor = 1.0f )

References push_aabb3f().

Referenced by ModApiEnv::l_get_node_boxes(), and push_nodebox().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_ARGB8()

void push_ARGB8 ( lua_State * L,
video::SColor color )

◆ push_v2f()

void push_v2f ( lua_State * L,
v2f p )

References p().

Referenced by ObjectRef::l_get_animation(), ObjectRef::l_get_local_animation(), ModApiServer::l_get_player_window_information(), ModApiMainMenu::l_get_window_info(), and push_hud_element().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_v2s16()

void push_v2s16 ( lua_State * L,
v2s16 p )

References p().

Referenced by push_object_properties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_v2s32()

void push_v2s32 ( lua_State * L,
v2s32 p )

References p().

Referenced by push_hud_element().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_v2u32()

void push_v2u32 ( lua_State * L,
v2u32 p )

References p().

Referenced by ModApiServer::l_get_player_window_information(), and ModApiMainMenu::l_get_window_info().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_v3f()

◆ push_v3s16()

void push_v3s16 ( lua_State * L,
v3s16 p )

References CUSTOM_RIDX_PUSH_VECTOR, and p().

Referenced by ScriptApiEnv::check_for_falling(), ScriptApiEnv::environment_OnGenerated(), ModApiEnvBase::findNodeNear(), ModApiEnvBase::findNodesInArea(), ModApiEnvBase::findNodesInAreaUnderAir(), ModApiEnv::l_find_nodes_with_meta(), ModApiEnv::l_find_path(), LuaVoxelManip::l_get_emerged_area(), InvRef::l_get_location(), ModApiMapgen::l_get_mapgen_edges(), ModApiMapgen::l_get_mapgen_object(), LuaMinimap::l_get_pos(), ModApiEnv::l_line_of_sight(), LuaVoxelManip::l_read_from_map(), ModApiMapgen::l_read_schematic(), ModApiRollback::l_rollback_get_node_actions(), 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(), ScriptApiClient::on_dignode(), ScriptApiEnv::on_emerge_area_completion(), ScriptApiMapgen::on_generated(), ScriptApiEnv::on_liquid_transformed(), ScriptApiClient::on_punchnode(), push_area(), push_collision_move_result(), push_pointed_thing(), ScriptApiBase::pushPlayerHPChangeReason(), ScriptApiEnv::triggerABM(), and ScriptApiEnv::triggerLBM().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pushFloatPos()

void pushFloatPos ( lua_State * L,
v3f p )

References BS, p(), and push_v3f().

Referenced by ScriptApiItem::item_OnDrop(), ObjectRef::l_get_acceleration(), and ObjectRef::l_get_velocity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_aabb3f()

aabb3f read_aabb3f ( lua_State * L,
int index,
f32 scale )

Referenced by read_aabb3f_vector(), and read_object_properties().

+ Here is the caller graph for this function:

◆ read_aabb3f_vector()

std::vector< aabb3f > read_aabb3f_vector ( lua_State * L,
int index,
f32 scale )

References read_aabb3f().

+ Here is the call graph for this function:

◆ read_ARGB8()

video::SColor read_ARGB8 ( lua_State * L,
int index )

References CHECK_TYPE.

Referenced by read_color().

+ Here is the caller graph for this function:

◆ read_color()

bool read_color ( lua_State * L,
int index,
video::SColor * color )

References parseColorString(), and read_ARGB8().

Referenced by ModApiUtil::l_colorspec_to_bytes(), ModApiUtil::l_colorspec_to_colorstring(), ModApiUtil::l_colorspec_to_table(), ObjectRef::l_set_clouds(), ObjectRef::l_set_lighting(), ObjectRef::l_set_nametag_attributes(), ObjectRef::l_set_sky(), ObjectRef::l_set_stars(), read_content_features(), read_item_definition(), read_object_properties(), read_tiledef(), and read_wear_bar_params().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_stringlist()

size_t read_stringlist ( lua_State * L,
int index,
std::vector< std::string > * result )

Referenced by getstringlistfield().

+ Here is the caller graph for this function:

◆ read_v2f()

v2f read_v2f ( lua_State * L,
int index )

References CHECK_POS_TAB, and p().

Referenced by ObjectRef::l_set_local_animation(), read_hud_change(), read_hud_element(), and read_object_properties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_v2s16()

v2s16 read_v2s16 ( lua_State * L,
int index )

References CHECK_POS_TAB, and p().

Referenced by read_object_properties(), and LuaHelper::readParam().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_v2s32()

v2s32 read_v2s32 ( lua_State * L,
int index )

References CHECK_POS_TAB, and p().

Referenced by read_hud_change(), and read_hud_element().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_v3f()

v3f read_v3f ( lua_State * L,
int index )

References read_v3_aux().

Referenced by ModApiEnv::l_get_objects_in_area(), ModApiClientSound::l_sound_play(), read_hud_change(), read_hud_element(), read_noiseparams(), and read_server_sound_params().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_v3s16()

v3s16 read_v3s16 ( lua_State * L,
int index )

References doubleToInt(), and read_v3d().

Referenced by LuaPerlinNoiseMap::create_object(), ModApiEnv::l_add_node_level(), ModApiEnvVM::l_add_node_level(), ModApiEnv::l_bulk_set_node(), ModApiEnv::l_bulk_swap_node(), ModApiEnv::l_delete_area(), ModApiEnv::l_dig_node(), ModApiEnv::l_emerge_area(), ModApiEnv::l_find_node_near(), ModApiEnvVM::l_find_node_near(), ModApiEnv::l_find_nodes_in_area(), ModApiEnvVM::l_find_nodes_in_area(), ModApiEnv::l_find_nodes_in_area_under_air(), ModApiEnvVM::l_find_nodes_in_area_under_air(), ModApiEnv::l_find_path(), ModApiEnv::l_fix_light(), ModApiEnv::l_forceload_block(), ModApiEnv::l_forceload_free_block(), ModApiMapgen::l_get_biome_data(), ModApiMapgen::l_get_heat(), ModApiMapgen::l_get_humidity(), LuaPerlinNoiseMap::l_get_map_slice(), ModApiClient::l_get_meta(), ModApiEnv::l_get_meta(), ModApiEnv::l_get_natural_light(), ModApiEnv::l_get_node_boxes(), ModApiEnv::l_get_node_level(), ModApiEnvVM::l_get_node_level(), ModApiEnv::l_get_node_light(), ModApiEnv::l_get_node_max_level(), ModApiEnvVM::l_get_node_max_level(), ModApiClient::l_get_node_or_nil(), ModApiEnvVM::l_get_node_or_nil(), ModApiEnv::l_get_node_timer(), ModApiEnv::l_get_perlin_map(), ModApiEnv::l_place_node(), ModApiEnv::l_punch_node(), ModApiEnv::l_remove_node(), ModApiRollback::l_rollback_get_node_actions(), ObjectRef::l_send_mapblock(), ModApiEnv::l_set_node(), ModApiEnv::l_set_node_level(), ModApiEnvVM::l_set_node_level(), LuaMinimap::l_set_pos(), ModApiEnv::l_spawn_tree(), ModApiEnvVM::l_spawn_tree(), ModApiEnv::l_swap_node(), and ModApiEnv::l_transforming_liquid_add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setboolfield()

void setboolfield ( lua_State * L,
int table,
const char * fieldname,
bool value )

References table.

Referenced by ModApiClient::l_get_csm_restrictions(), push_collision_move_result(), push_dig_params(), ModApiHttp::push_http_fetch_result(), and ScriptApiMainMenu::setMainMenuData().

+ Here is the caller graph for this function:

◆ setfloatfield()

void setfloatfield ( lua_State * L,
int table,
const char * fieldname,
float value )

References table.

Referenced by push_dig_params(), push_noiseparams(), and push_tool_capabilities().

+ Here is the caller graph for this function:

◆ setintfield()

void setintfield ( lua_State * L,
int table,
const char * fieldname,
int value )

References table.

Referenced by ModApiCraft::l_get_craft_recipe(), ModApiCraft::l_get_craft_result(), push_craft_recipe(), push_dig_params(), push_hit_params(), ModApiHttp::push_http_fetch_result(), push_noiseparams(), and push_tool_capabilities().

+ Here is the caller graph for this function:

◆ setstringfield()

void setstringfield ( lua_State * L,
int table,
const char * fieldname,
const std::string & value )

References table.

Referenced by ModApiServer::l_get_game_info(), ModApiHttp::push_http_fetch_result(), and push_wear_bar_params().

+ Here is the caller graph for this function:

◆ warn_if_field_exists()

void warn_if_field_exists ( lua_State * L,
int table,
const char * fieldname,
std::string_view name,
std::string_view message )

References infostream, script_get_backtrace(), table, and warningstream.

Referenced by ModApiMapgen::l_register_ore(), and read_content_features().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ write_array_slice_float()

size_t write_array_slice_float ( lua_State * L,
int table_index,
float * data,
v3u16 data_size,
v3u16 slice_offset,
v3u16 slice_size )

References MYMIN.

Referenced by LuaPerlinNoiseMap::l_get_map_slice().

+ Here is the caller graph for this function: