The Battle for Wesnoth  1.19.0-dev
Namespaces | Functions | Variables
lua_race.cpp File Reference
#include "scripting/lua_race.hpp"
#include "units/race.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/push_check.hpp"
#include "units/types.hpp"
#include <string>
#include <cstring>
Include dependency graph for lua_race.cpp:

Go to the source code of this file.

Namespaces

 lua_race
 This namespace contains bindings for lua to hold a pointer to a race, and to access and modify it.
 

Functions

static int impl_race_get (lua_State *L)
 Gets some data on a race (__index metamethod). More...
 
static int impl_race_tostring (lua_State *L)
 Turns a lua proxy race to string. More...
 
std::string lua_race::register_metatable (lua_State *L)
 
void luaW_pushrace (lua_State *L, const unit_race &race)
 
void luaW_pushracetable (lua_State *L)
 
const unit_raceluaW_checkrace (lua_State *L, int idx)
 

Variables

static const char * Race = "race"
 Implementation for a lua reference to a race, used by the wesnoth in-game races table. More...
 
static const char * Gen = "name generator"
 

Function Documentation

◆ impl_race_get()

static int impl_race_get ( lua_State *  L)
static

◆ impl_race_tostring()

static int impl_race_tostring ( lua_State *  L)
static

Turns a lua proxy race to string.

(__tostring metamethod)

Definition at line 91 of file lua_race.cpp.

References unit_race::id(), lua_push(), and luaW_checkrace().

Referenced by lua_race::register_metatable().

◆ luaW_checkrace()

const unit_race& luaW_checkrace ( lua_State *  L,
int  idx 
)

Definition at line 141 of file lua_race.cpp.

References unit_type_data::find_race(), and unit_types.

Referenced by impl_race_get(), and impl_race_tostring().

◆ luaW_pushrace()

void luaW_pushrace ( lua_State *  L,
const unit_race race 
)

Definition at line 120 of file lua_race.cpp.

References unit_race::id(), and Race.

Referenced by luaW_pushracetable().

◆ luaW_pushracetable()

void luaW_pushracetable ( lua_State *  L)

Definition at line 128 of file lua_race.cpp.

References luaW_pushrace(), unit_type_data::races(), and unit_types.

Referenced by game_lua_kernel::initialize().

Variable Documentation

◆ Gen

const char* Gen = "name generator"
static

Definition at line 34 of file lua_race.cpp.

Referenced by impl_race_get().

◆ Race

const char* Race = "race"
static

Implementation for a lua reference to a race, used by the wesnoth in-game races table.

Definition at line 33 of file lua_race.cpp.

Referenced by luaW_pushrace(), and lua_race::register_metatable().