The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Typedefs | Functions
lua_common Namespace Reference

Typedefs

typedef std::pair
< vconfig::all_children_iterator,
vconfig::all_children_iterator
vconfig_child_range
 

Functions

static int impl_gettext (lua_State *L)
 Creates a t_string object (__call metamethod). More...
 
int intf_textdomain (lua_State *L)
 Creates an interface for gettext. More...
 
static void tstring_concat_aux (lua_State *L, t_string &dst, int src)
 Converts a Lua value at position src and appends it to dst. More...
 
static int impl_tstring_concat (lua_State *L)
 Appends a scalar to a t_string object (__concat metamethod). More...
 
static int impl_tstring_collect (lua_State *L)
 Destroys a t_string object before it is collected (__gc metamethod). More...
 
static int impl_tstring_lt (lua_State *L)
 
static int impl_tstring_le (lua_State *L)
 
static int impl_tstring_eq (lua_State *L)
 
static int impl_tstring_tostring (lua_State *L)
 Converts a t_string object to a string (__tostring metamethod); that is, performs a translation. More...
 
static int impl_vconfig_get (lua_State *L)
 Gets the parsed field of a vconfig object (_index metamethod). More...
 
static int impl_vconfig_size (lua_State *L)
 Returns the number of a child of a vconfig object. More...
 
static int impl_vconfig_collect (lua_State *L)
 Destroys a vconfig object before it is collected (__gc metamethod). More...
 
static int impl_vconfig_pairs_iter (lua_State *L)
 Iterate through the attributes of a vconfig. More...
 
static int impl_vconfig_pairs_collect (lua_State *L)
 Destroy a vconfig pairs iterator. More...
 
static int impl_vconfig_pairs (lua_State *L)
 Construct an iterator to iterate through the attributes of a vconfig. More...
 
static int impl_vconfig_ipairs_iter (lua_State *L)
 Iterate through the subtags of a vconfig. More...
 
static int impl_vconfig_ipairs_collect (lua_State *L)
 Destroy a vconfig ipairs iterator. More...
 
static int impl_vconfig_ipairs (lua_State *L)
 Construct an iterator to iterate through the subtags of a vconfig. More...
 
int intf_tovconfig (lua_State *L)
 Creates a vconfig containing the WML table. More...
 
std::string register_gettext_metatable (lua_State *L)
 Adds the gettext metatable. More...
 
std::string register_tstring_metatable (lua_State *L)
 Adds the tstring metatable. More...
 
std::string register_vconfig_metatable (lua_State *L)
 Adds the vconfig metatable. More...
 

Typedef Documentation

Definition at line 310 of file lua_common.cpp.

Function Documentation

static int lua_common::impl_gettext ( lua_State L)
static

Creates a t_string object (__call metamethod).

  • Arg 1: userdata containing the domain.
  • Arg 2: string to translate.
  • Ret 1: string containing the translatable string.

Definition at line 63 of file lua_common.cpp.

References d, lua_touserdata(), luaL_checkstring, and luaW_pushtstring().

Referenced by register_gettext_metatable().

static int lua_common::impl_tstring_collect ( lua_State L)
static

Destroys a t_string object before it is collected (__gc metamethod).

Definition at line 134 of file lua_common.cpp.

References lua_touserdata().

Referenced by register_tstring_metatable().

static int lua_common::impl_tstring_concat ( lua_State L)
static

Appends a scalar to a t_string object (__concat metamethod).

Definition at line 118 of file lua_common.cpp.

References lua_newuserdata(), luaL_setmetatable(), tstring_concat_aux(), and tstringKey.

Referenced by register_tstring_metatable().

static int lua_common::impl_tstring_eq ( lua_State L)
static
static int lua_common::impl_tstring_le ( lua_State L)
static
static int lua_common::impl_tstring_lt ( lua_State L)
static
static int lua_common::impl_tstring_tostring ( lua_State L)
static

Converts a t_string object to a string (__tostring metamethod); that is, performs a translation.

Definition at line 169 of file lua_common.cpp.

References t_string::c_str(), lua_pushstring(), and lua_touserdata().

Referenced by register_tstring_metatable().

static int lua_common::impl_vconfig_collect ( lua_State L)
static

Destroys a vconfig object before it is collected (__gc metamethod).

Definition at line 259 of file lua_common.cpp.

References lua_touserdata(), and vconfig::~vconfig().

Referenced by register_vconfig_metatable().

static int lua_common::impl_vconfig_get ( lua_State L)
static
static int lua_common::impl_vconfig_ipairs ( lua_State L)
static
static int lua_common::impl_vconfig_ipairs_collect ( lua_State L)
static

Destroy a vconfig ipairs iterator.

Definition at line 337 of file lua_common.cpp.

References lua_touserdata().

Referenced by register_vconfig_metatable().

static int lua_common::impl_vconfig_ipairs_iter ( lua_State L)
static
static int lua_common::impl_vconfig_pairs ( lua_State L)
static
static int lua_common::impl_vconfig_pairs_collect ( lua_State L)
static

Destroy a vconfig pairs iterator.

Definition at line 286 of file lua_common.cpp.

References lua_touserdata().

Referenced by register_vconfig_metatable().

static int lua_common::impl_vconfig_pairs_iter ( lua_State L)
static

Iterate through the attributes of a vconfig.

Definition at line 269 of file lua_common.cpp.

References lua_pushlstring(), lua_upvalueindex, luaL_checkudata(), luaW_checkvconfig(), luaW_pushscalar(), and vconfigpairsKey.

Referenced by impl_vconfig_pairs().

static int lua_common::impl_vconfig_size ( lua_State L)
static

Returns the number of a child of a vconfig object.

Definition at line 248 of file lua_common.cpp.

References lua_pushinteger(), lua_touserdata(), vconfig::null(), vconfig::ordered_begin(), and vconfig::ordered_end().

Referenced by register_vconfig_metatable().

int lua_common::intf_textdomain ( lua_State L)

Creates an interface for gettext.

  • Arg 1: string containing the domain.
  • Ret 1: a full userdata with __call pointing to lua_gettext.

Definition at line 77 of file lua_common.cpp.

References gettextKey, lua_newuserdata(), luaL_checklstring(), and luaL_setmetatable().

Referenced by lua_kernel_base::lua_kernel_base().

int lua_common::intf_tovconfig ( lua_State L)

Creates a vconfig containing the WML table.

  • Arg 1: WML table.
  • Ret 1: vconfig userdata.

Definition at line 366 of file lua_common.cpp.

References luaW_checkvconfig(), and luaW_pushvconfig().

Referenced by lua_kernel_base::lua_kernel_base().

std::string lua_common::register_gettext_metatable ( lua_State L)

Adds the gettext metatable.

Definition at line 376 of file lua_common.cpp.

References gettextKey, impl_gettext(), lua_pushstring(), lua_setfield(), luaL_newmetatable(), and luaL_setfuncs().

Referenced by lua_kernel_base::lua_kernel_base().

std::string lua_common::register_tstring_metatable ( lua_State L)
std::string lua_common::register_vconfig_metatable ( lua_State L)
static void lua_common::tstring_concat_aux ( lua_State L,
t_string dst,
int  src 
)
static

Converts a Lua value at position src and appends it to dst.

Note
This function is private to lua_tstring_concat. It expects two things. First, the t_string metatable is at the top of the stack on entry. (It is still there on exit.) Second, the caller hasn't any valuable object with dynamic lifetime, since they would be leaked on error.

Definition at line 96 of file lua_common.cpp.

References LUA_TNUMBER, lua_tostring, LUA_TSTRING, LUA_TUSERDATA, lua_type(), luaL_testudata(), luaL_typerror(), and tstringKey.

Referenced by impl_tstring_concat().