34 static const char *
Race =
"race";
35 static const char *
Gen =
"name generator";
55 if (strcmp(m,
"traits") == 0) {
59 const std::string&
id = trait[
"id"];
66 const std::string&
id = trait[
"id"];
73 if (strcmp(m,
"male_name_gen") == 0) {
79 if (strcmp(m,
"female_name_gen") == 0) {
95 std::ostringstream str;
96 str <<
"race: <" << race.
id() <<
'>';
117 return "Adding getrace metatable...\n";
134 for (
const race_map::value_type &race : races)
136 assert(race.first == race.second.id());
LUA_API void lua_createtable(lua_State *L, int narray, int nrec)
#define return_tstring_attrib(name, accessor)
void luaW_pushconfig(lua_State *L, const config &cfg)
Converts a config object to a Lua table pushed at the top of the stack.
config_array_view traits() const
const std::string & id() const
const name_generator & generator(GENDER gender) const
#define return_string_attrib(name, accessor)
LUA_API int lua_rawget(lua_State *L, int idx)
unit_type_data unit_types
#define luaL_getmetatable(L, n)
const t_string & description() const
const race_map & races() const
LUALIB_API void luaL_setmetatable(lua_State *L, const char *tname)
void lua_push(lua_State *L, const T &val)
const unit_race & luaW_checkrace(lua_State *L, int idx)
const t_string & name(GENDER gender=MALE) const
#define return_cfgref_attrib(name, accessor)
static int impl_race_tostring(lua_State *L)
Turns a lua proxy race to string.
LUALIB_API int luaL_argerror(lua_State *L, int arg, const char *extramsg)
#define return_int_attrib(name, accessor)
This namespace contains bindings for lua to hold a pointer to a race, and to access and modify it...
const t_string & plural_name() const
LUA_API const char * lua_pushlstring(lua_State *L, const char *s, size_t len)
LUA_API int lua_setmetatable(lua_State *L, int objindex)
const config::const_child_itors & additional_traits() const
static const char * Race
Implementation for a lua reference to a race, used by the wesnoth in-game races table.
unsigned int num_traits() const
LUALIB_API int luaL_newmetatable(lua_State *L, const char *tname)
const config & get_cfg() const
const unit_race * find_race(const std::string &) const
void luaW_pushracetable(lua_State *L)
static int impl_race_get(lua_State *L)
Gets some data on a race (__index metamethod).
LUA_API void lua_rawset(lua_State *L, int idx)
bool uses_global_traits() const
#define lua_tostring(L, i)
std::string register_metatable(lua_State *L)
void luaW_pushrace(lua_State *L, const unit_race &race)
#define return_bool_attrib(name, accessor)
LUALIB_API void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup)
std::map< std::string, unit_race > race_map
A config object defines a single node in a WML file, with access to child nodes.
const std::string & undead_variation() const
LUA_API const char * lua_pushstring(lua_State *L, const char *s)
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
#define luaL_checkstring(L, n)