Go to the source code of this file.
Classes | |
class | lua_unit |
Storage for a unit, either owned by the Lua code (ptr != 0), a local variable unit (c_ptr != 0), on a recall list (side != 0), or on the map. More... | |
Namespaces | |
lua_units | |
Functions | |
bool | luaW_isunit (lua_State *, int index) |
Test if a Lua value is a unit. More... | |
unit * | luaW_tounit (lua_State *L, int index, bool only_on_map=false) |
Converts a Lua value to a unit pointer. More... | |
unit & | luaW_checkunit (lua_State *L, int index, bool only_on_map=false) |
Converts a Lua value to a unit pointer. More... | |
lua_unit * | luaW_pushlocalunit (lua_State *L, unit &u) |
Pushes a private unit on the stack. More... | |
unit_ptr | luaW_tounit_ptr (lua_State *L, int index, bool only_on_map) |
Similar to luaW_tounit but returns a unit_ptr; use this instead of luaW_tounit when using an api that needs unit_ptr. More... | |
unit_ptr | luaW_checkunit_ptr (lua_State *L, int index, bool only_on_map) |
Similar to luaW_checkunit but returns a unit_ptr; use this instead of luaW_checkunit when using an api that needs unit_ptr. More... | |
lua_unit * | luaW_tounit_ref (lua_State *L, int index) |
Similar to luaW_tounit but returns a lua_unit; use this if you need to handle map and recall units differently, for example. More... | |
lua_unit * | luaW_checkunit_ref (lua_State *L, int index) |
Similar to luaW_checkunit but returns a lua_unit; use this if you need to handle map and recall units differently, for example. More... | |
template<typename... Args> | |
lua_unit * | luaW_pushunit (lua_State *L, Args... args) |
std::string | lua_units::register_metatables (lua_State *L) |
unit& luaW_checkunit | ( | lua_State * | L, |
int | index, | ||
bool | only_on_map = false |
||
) |
Converts a Lua value to a unit pointer.
Definition at line 191 of file lua_unit.cpp.
References utf8::index(), internal_get_unit(), and unit_show_error().
Referenced by game_lua_kernel::cfun_builtin_effect(), impl_unit_attacks_set(), impl_unit_equality(), intf_add_modification(), intf_advance_unit(), intf_copy_unit(), game_lua_kernel::intf_find_path(), game_lua_kernel::intf_find_reach(), game_lua_kernel::intf_find_vision_range(), intf_remove_modifications(), game_lua_kernel::intf_simulate_combat(), intf_transform_unit(), game_lua_kernel::intf_unit_ability(), intf_unit_defense(), intf_unit_jamming_cost(), intf_unit_movement_cost(), intf_unit_resistance(), and intf_unit_vision_cost().
unit_ptr luaW_checkunit_ptr | ( | lua_State * | L, |
int | index, | ||
bool | only_on_map | ||
) |
Similar to luaW_checkunit but returns a unit_ptr; use this instead of luaW_checkunit when using an api that needs unit_ptr.
Definition at line 183 of file lua_unit.cpp.
References utf8::index(), internal_get_unit(), and unit_show_error().
Referenced by impl_add_animation(), game_lua_kernel::intf_find_vacant_tile(), and game_lua_kernel::intf_teleport().
lua_unit* luaW_checkunit_ref | ( | lua_State * | L, |
int | index | ||
) |
Similar to luaW_checkunit but returns a lua_unit; use this if you need to handle map and recall units differently, for example.
Definition at line 199 of file lua_unit.cpp.
References utf8::index(), internal_get_unit(), and unit_show_error().
Referenced by game_lua_kernel::intf_erase_unit(), game_lua_kernel::intf_extract_unit(), game_lua_kernel::intf_match_unit(), game_lua_kernel::intf_put_recall_unit(), and game_lua_kernel::intf_put_unit().
bool luaW_isunit | ( | lua_State * | L, |
int | index | ||
) |
Test if a Lua value is a unit.
Definition at line 113 of file lua_unit.cpp.
References getunitKey, and utf8::index().
Referenced by internal_get_unit(), game_lua_kernel::intf_erase_unit(), game_lua_kernel::intf_find_vacant_tile(), game_lua_kernel::intf_get_locations(), game_lua_kernel::intf_match_location(), game_lua_kernel::intf_put_recall_unit(), and game_lua_kernel::intf_put_unit().
Pushes a private unit on the stack.
Definition at line 91 of file lua_unit.cpp.
Referenced by game_lua_kernel::apply_effect(), and game_lua_kernel::run_filter().
|
inline |
Definition at line 116 of file lua_unit.hpp.
Referenced by ai::call_lua_filter_fcn(), ai::impl_ai_aspect_get(), intf_copy_unit(), intf_create_unit(), game_lua_kernel::intf_get_displayed_unit(), game_lua_kernel::intf_get_recall_units(), game_lua_kernel::intf_get_unit(), game_lua_kernel::intf_get_units(), and luaW_pushfaivariant().
unit* luaW_tounit | ( | lua_State * | L, |
int | index, | ||
bool | only_on_map = false |
||
) |
Converts a Lua value to a unit pointer.
Definition at line 142 of file lua_unit.cpp.
References utf8::index(), internal_get_unit(), and LU_OK.
Referenced by ai::cfun_ai_get_suitable_keep(), impl_unit_attacks_len(), impl_unit_status_dir(), impl_unit_status_get(), impl_unit_status_set(), impl_unit_variables_dir(), impl_unit_variables_get(), impl_unit_variables_set(), lua_formula_bridge::intf_eval_formula(), game_lua_kernel::intf_find_cost_map(), game_lua_kernel::intf_get_locations(), game_lua_kernel::intf_get_units(), game_lua_kernel::intf_match_location(), game_lua_kernel::intf_match_unit(), luaW_tofaivariant(), and WIDGET_SETTER().
unit_ptr luaW_tounit_ptr | ( | lua_State * | L, |
int | index, | ||
bool | only_on_map | ||
) |
Similar to luaW_tounit but returns a unit_ptr; use this instead of luaW_tounit when using an api that needs unit_ptr.
Definition at line 152 of file lua_unit.cpp.
References utf8::index(), internal_get_unit(), and LU_OK.
lua_unit* luaW_tounit_ref | ( | lua_State * | L, |
int | index | ||
) |
Similar to luaW_tounit but returns a lua_unit; use this if you need to handle map and recall units differently, for example.
Note that this only returns null if the element on the stack was not a unit, so it may be an invalid unit.
Definition at line 162 of file lua_unit.cpp.
References utf8::index(), and internal_get_unit().
Referenced by impl_unit_attacks_get(), and impl_unit_tostring().