The Battle for Wesnoth  1.15.1+dev
Namespaces | Functions | Variables
lua_team.cpp File Reference
#include "scripting/lua_team.hpp"
#include "scripting/lua_common.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_set (lua_State *L)
 Sets some data on a side (__newindex metamethod). More...
 
static int impl_side_equal (lua_State *L)
 
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...
 

Function Documentation

◆ impl_side_equal()

static int impl_side_equal ( lua_State L)
static

Definition at line 195 of file lua_team.cpp.

References lua_pushboolean(), luaW_checkteam(), luaW_toteam(), and team::side().

Referenced by lua_team::register_metatable().

◆ impl_side_get()

static int impl_side_get ( lua_State L)
static

◆ impl_side_set()

static int impl_side_set ( lua_State L)
static

◆ 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 238 of file lua_team.cpp.

References luaL_checkudata(), and Team.

Referenced by impl_side_equal(), impl_side_get(), and impl_side_set().

◆ luaW_pushteam()

void luaW_pushteam ( lua_State L,
team tm 
)

Create a full userdata containing a pointer to the team.

Definition at line 231 of file lua_team.cpp.

References lua_newuserdata(), luaL_setmetatable(), t, and Team.

Referenced by game_lua_kernel::intf_get_sides().

◆ luaW_toteam()

team* luaW_toteam ( lua_State L,
int  idx 
)

Test if the top stack element is a team, and if so, return it.

Definition at line 243 of file lua_team.cpp.

References luaL_testudata(), p, and Team.

Referenced by impl_side_equal(), and game_lua_kernel::intf_match_side().

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 42 of file lua_team.cpp.

Referenced by luaW_checkteam(), luaW_pushteam(), luaW_toteam(), and lua_team::register_metatable().