#include "scripting/lua_unit_type.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_unit_attacks.hpp"
#include "scripting/push_check.hpp"
#include "units/types.hpp"
#include <string>
#include <cstring>
#include "lua/lauxlib.h"
Go to the source code of this file.
Namespaces | |
lua_unit_type | |
This namespace contains bindings for lua to hold a reference to a unit type and access its stats. | |
Functions | |
static int | impl_unit_type_get (lua_State *L) |
Gets some data on a unit type (__index metamethod). More... | |
static int | impl_unit_type_equal (lua_State *L) |
static int | impl_unit_type_lookup (lua_State *L) |
static int | impl_unit_type_new (lua_State *L) |
static int | impl_unit_type_count (lua_State *L) |
static int | impl_unit_type_next (lua_State *L) |
static int | impl_unit_type_pairs (lua_State *L) |
static int | impl_unit_type_tostring (lua_State *L) |
Turns a lua proxy unit type to string. More... | |
std::string | lua_unit_type::register_metatable (lua_State *L) |
std::string | lua_unit_type::register_table (lua_State *L) |
void | luaW_pushunittype (lua_State *L, const unit_type &ut) |
Create a lua object containing a reference to a unittype, and a metatable to access the properties. More... | |
const unit_type * | luaW_tounittype (lua_State *L, int idx) |
Test if a stack element is a unit type, and return it if so. More... | |
const unit_type & | luaW_checkunittype (lua_State *L, int idx) |
Test if a stack element is a unit type, and return it if so. More... | |
Variables | |
static const char | UnitType [] = "unit type" |
Implementation for a lua reference to a unit_type. More... | |
static const char | UnitTypeTable [] = "unit types" |
|
static |
Definition at line 131 of file lua_unit_type.cpp.
References unit_type_data::types(), and unit_types.
Referenced by lua_unit_type::register_table().
|
static |
Definition at line 92 of file lua_unit_type.cpp.
References luaW_checkunittype(), and luaW_tounittype().
Referenced by lua_unit_type::register_metatable().
|
static |
Gets some data on a unit type (__index metamethod).
Definition at line 42 of file lua_unit_type.cpp.
References unit_type::advances_from(), unit_type::advances_to(), unit_type::alignment(), unit_type::big_profile(), unit_type::cost(), unit_type::experience_needed(), unit_type::get_ability_list(), unit_type::get_cfg(), string_enums::enum_base< Definition >::get_string(), unit_type::hitpoints(), unit_type::icon(), unit_type::id(), unit_type::image(), unit_type::level(), lua_push(), luaW_checkunittype(), luaW_pushconfig(), unit_type::movement(), unit_type::possible_traits(), push_unit_attacks_table(), unit_type::race_id(), unit_type::recall_cost(), return_cfgref_attrib, return_int_attrib, return_string_attrib, return_tstring_attrib, return_vector_string_attrib, unit_type::small_profile(), unit_type::type_name(), and UnitTypeTable.
Referenced by lua_unit_type::register_metatable().
|
static |
Definition at line 103 of file lua_unit_type.cpp.
References unit_type_data::find(), unit_type::get_gender_unit_type(), unit_type::get_variation(), luaW_pushunittype(), unit_types, and UnitTypeTable.
Referenced by lua_unit_type::register_table().
|
static |
Definition at line 123 of file lua_unit_type.cpp.
Referenced by lua_unit_type::register_table().
|
static |
Definition at line 137 of file lua_unit_type.cpp.
References unit_map::begin(), unit_map::end(), unit_race::FEMALE, unit_map::find(), unit_type::get_gender_unit_type(), unit_type::has_gender_variation(), luaW_pushunittype(), unit_race::MALE, unit_type_data::types(), unit_types, UnitTypeTable, and unit_type::variation_types().
Referenced by impl_unit_type_pairs().
|
static |
Definition at line 182 of file lua_unit_type.cpp.
References impl_unit_type_next().
Referenced by lua_unit_type::register_table().
|
static |
Turns a lua proxy unit type to string.
(__tostring metamethod)
Definition at line 192 of file lua_unit_type.cpp.
References unit_type::id(), lua_push(), and luaW_checkunittype().
Referenced by lua_unit_type::register_metatable().
const unit_type& luaW_checkunittype | ( | lua_State * | L, |
int | idx | ||
) |
Test if a stack element is a unit type, and return it if so.
Definition at line 257 of file lua_unit_type.cpp.
References UnitType.
Referenced by impl_unit_type_equal(), impl_unit_type_get(), and impl_unit_type_tostring().
void luaW_pushunittype | ( | lua_State * | L, |
const unit_type & | ut | ||
) |
Create a lua object containing a reference to a unittype, and a metatable to access the properties.
Definition at line 243 of file lua_unit_type.cpp.
References UnitType.
Referenced by impl_unit_type_lookup(), impl_unit_type_next(), and luaW_pushfaivariant().
const unit_type* luaW_tounittype | ( | lua_State * | L, |
int | idx | ||
) |
Test if a stack element is a unit type, and return it if so.
Definition at line 249 of file lua_unit_type.cpp.
Referenced by impl_unit_attacks_get(), impl_unit_attacks_len(), impl_unit_attacks_set(), impl_unit_type_equal(), lua_formula_bridge::intf_eval_formula(), luaW_tofaivariant(), and WIDGET_SETTER().
|
static |
Implementation for a lua reference to a unit_type.
Definition at line 33 of file lua_unit_type.cpp.
Referenced by luaW_checkunittype(), luaW_pushunittype(), luaW_tounittype(), and lua_unit_type::register_metatable().
|
static |
Definition at line 34 of file lua_unit_type.cpp.
Referenced by impl_unit_type_get(), impl_unit_type_lookup(), impl_unit_type_next(), and lua_unit_type::register_table().