The Battle for Wesnoth  1.19.0-dev
Namespaces | Functions | Variables
lua_unit_type.cpp File Reference
#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 dependency graph for lua_unit_type.cpp:

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_typeluaW_tounittype (lua_State *L, int idx)
 Test if a stack element is a unit type, and return it if so. More...
 
const unit_typeluaW_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"
 

Function Documentation

◆ impl_unit_type_count()

static int impl_unit_type_count ( lua_State *  L)
static

Definition at line 130 of file lua_unit_type.cpp.

References unit_type_data::types(), and unit_types.

Referenced by lua_unit_type::register_table().

◆ impl_unit_type_equal()

static int impl_unit_type_equal ( lua_State *  L)
static

Definition at line 91 of file lua_unit_type.cpp.

References luaW_checkunittype(), and luaW_tounittype().

Referenced by lua_unit_type::register_metatable().

◆ impl_unit_type_get()

static int impl_unit_type_get ( lua_State *  L)
static

◆ impl_unit_type_lookup()

static int impl_unit_type_lookup ( lua_State *  L)
static

◆ impl_unit_type_new()

static int impl_unit_type_new ( lua_State *  L)
static

Definition at line 122 of file lua_unit_type.cpp.

Referenced by lua_unit_type::register_table().

◆ impl_unit_type_next()

static int impl_unit_type_next ( lua_State *  L)
static

◆ impl_unit_type_pairs()

static int impl_unit_type_pairs ( lua_State *  L)
static

Definition at line 185 of file lua_unit_type.cpp.

References impl_unit_type_next().

Referenced by lua_unit_type::register_table().

◆ impl_unit_type_tostring()

static int impl_unit_type_tostring ( lua_State *  L)
static

Turns a lua proxy unit type to string.

(__tostring metamethod)

Definition at line 195 of file lua_unit_type.cpp.

References unit_type::id(), lua_push(), and luaW_checkunittype().

Referenced by lua_unit_type::register_metatable().

◆ luaW_checkunittype()

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 260 of file lua_unit_type.cpp.

References UnitType.

Referenced by impl_unit_type_equal(), impl_unit_type_get(), and impl_unit_type_tostring().

◆ luaW_pushunittype()

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 246 of file lua_unit_type.cpp.

References UnitType.

Referenced by impl_unit_type_lookup(), impl_unit_type_next(), and luaW_pushfaivariant().

◆ luaW_tounittype()

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 252 of file lua_unit_type.cpp.

References p, and UnitType.

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().

Variable Documentation

◆ UnitType

const char UnitType[] = "unit type"
static

Implementation for a lua reference to a unit_type.

Definition at line 32 of file lua_unit_type.cpp.

Referenced by luaW_checkunittype(), luaW_pushunittype(), luaW_tounittype(), and lua_unit_type::register_metatable().

◆ UnitTypeTable

const char UnitTypeTable[] = "unit types"
static