The Battle for Wesnoth  1.15.2+dev
Namespaces | Functions | Variables
lua_team.cpp File Reference
#include "scripting/lua_team.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/push_check.hpp"
#include "scripting/game_lua_kernel.hpp"
#include "team.hpp"
#include "resources.hpp"
#include "game_board.hpp"
#include "game_display.hpp"
#include <string>
#include "lua/lua.h"
#include "lua/lauxlib.h"
Include dependency graph for lua_team.cpp:

Go to the source code of this file.

Namespaces

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

Functions

static int impl_side_get (lua_State *L)
 Gets some data on a side (__index metamethod). More...
 
static int impl_side_tostring (lua_State *L)
 Turns a lua proxy side to string. More...
 
static int impl_side_set (lua_State *L)
 Sets some data on a side (__newindex metamethod). More...
 
static int impl_side_equal (lua_State *L)
 
static int impl_side_variables_get (lua_State *L)
 Gets the variable of a side (__index metamethod). More...
 
static int impl_side_variables_set (lua_State *L)
 Sets the variable of a side (__newindex metamethod). More...
 
std::string lua_team::register_metatable (lua_State *L)
 
void luaW_pushteam (lua_State *L, team &tm)
 Create a full userdata containing a pointer to the team. More...
 
teamluaW_checkteam (lua_State *L, int idx)
 Test if the top stack element is a team, and if not, error. More...
 
teamluaW_toteam (lua_State *L, int idx)
 Test if the top stack element is a team, and if so, return it. More...
 

Variables

static const char * Team = "side"
 Implementation for a lua reference to a team, used by the wesnoth in-game sides table. More...
 
static const char teamVar [] = "side variables"
 

Function Documentation

◆ impl_side_equal()

static int impl_side_equal ( lua_State L)
static

Definition at line 230 of file lua_team.cpp.

◆ impl_side_get()

static int impl_side_get ( lua_State L)
static

◆ impl_side_set()

static int impl_side_set ( lua_State L)
static

Sets some data on a side (__newindex metamethod).

  • Arg 1: full userdata containing the team.
  • Arg 2: string containing the name of the property.
  • Arg 3: something containing the attribute.

Definition at line 154 of file lua_team.cpp.

References none.

◆ impl_side_tostring()

static int impl_side_tostring ( lua_State L)
static

Turns a lua proxy side to string.

(__tostring metamethod)

Definition at line 133 of file lua_team.cpp.

References luaW_checkteam(), team::side(), and team::side_name().

◆ impl_side_variables_get()

static int impl_side_variables_get ( lua_State L)
static

Gets the variable of a side (__index metamethod).

  • Arg 1: table containing the userdata containing the side id.
  • Arg 2: string containing the name of the status.
  • Ret 1: boolean.

Definition at line 248 of file lua_team.cpp.

◆ impl_side_variables_set()

static int impl_side_variables_set ( lua_State L)
static

Sets the variable of a side (__newindex metamethod).

  • Arg 1: table containing the userdata containing the side id.
  • Arg 2: string containing the name of the status.
  • Arg 3: scalar.

Definition at line 269 of file lua_team.cpp.

◆ luaW_checkteam()

team& luaW_checkteam ( lua_State L,
int  idx 
)

Test if the top stack element is a team, and if not, error.

Definition at line 339 of file lua_team.cpp.

Referenced by impl_side_get(), and impl_side_tostring().

◆ luaW_pushteam()

void luaW_pushteam ( lua_State L,
team tm 
)

Create a full userdata containing a pointer to the team.

Definition at line 332 of file lua_team.cpp.

Referenced by game_lua_kernel::intf_get_side(), and game_lua_kernel::intf_get_sides().

◆ luaW_toteam()

team* luaW_toteam ( lua_State L,
int  idx 
)

Variable Documentation

◆ Team

const char* Team = "side"
static

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

(The userdata has type team** because lua holds only a pointer to a team, not a full-size team. If it were a full object then we would cast to type team *, since checkudata returns a pointer to the type corresponding to the sizeof expr used when we allocated the userdata.)

Definition at line 43 of file lua_team.cpp.

◆ teamVar

const char teamVar[] = "side variables"
static

Definition at line 44 of file lua_team.cpp.

Referenced by impl_side_get().