The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions | Variables
lua_api.cpp File Reference
#include "lua_api.hpp"
#include "lua_types.hpp"
#include "lua_jailbreak_exception.hpp"
#include "chat_events.hpp"
#include "config.hpp"
#include "display_chat_manager.hpp"
#include "game_display.hpp"
#include "log.hpp"
#include "map/location.hpp"
#include "resources.hpp"
#include "scripting/lua_common.hpp"
#include "tstring.hpp"
#include "units/unit.hpp"
#include "units/map.hpp"
#include "variable.hpp"
#include <boost/variant/static_visitor.hpp>
#include <map>
#include <new>
#include <ostream>
#include <utility>
#include <string>
#include "lua/lauxlib.h"
#include "lua/lua.h"
Include dependency graph for lua_api.cpp:

Go to the source code of this file.

Macros

#define LOG_LUA   LOG_STREAM(info, log_scripting_lua)
 
#define ERR_LUA   LOG_STREAM(err, log_scripting_lua)
 

Functions

void chat_message (std::string const &caption, std::string const &msg)
 Displays a message in the chat window. More...
 
bool luaW_pcall (lua_State *L, int nArgs, int nRets, bool allow_wml_error)
 Calls a Lua function stored below its nArgs arguments at the top of the stack. More...
 
unitluaW_tounit (lua_State *L, int index, bool only_on_map)
 Converts a Lua value to a unit pointer. More...
 
unit_ptr luaW_tounit_ptr (lua_State *L, int index, bool only_on_map)
 Similar to luaW_checkunit/luaW_tounit but returns a unit_ptr, use this instead of luaW_checkunit/luaW_tounit when uasing an api that needs unit_ptr. More...
 
unit_ptr luaW_checkunit_ptr (lua_State *L, int index, bool only_on_map)
 
unitluaW_checkunit (lua_State *L, int index, bool only_on_map)
 Converts a Lua value to a unit pointer. More...
 
lua_unitluaW_pushlocalunit (lua_State *L, unit &u)
 

Variables

static lg::log_domain log_scripting_lua ("scripting/lua")
 

Macro Definition Documentation

#define ERR_LUA   LOG_STREAM(err, log_scripting_lua)

Definition at line 46 of file lua_api.cpp.

Referenced by luaW_pcall(), and lua_unit::put_map().

#define LOG_LUA   LOG_STREAM(info, log_scripting_lua)

Definition at line 45 of file lua_api.cpp.

Function Documentation

void chat_message ( std::string const &  caption,
std::string const &  msg 
)
unit& luaW_checkunit ( lua_State L,
int  index,
bool  only_on_map 
)
unit_ptr luaW_checkunit_ptr ( lua_State L,
int  index,
bool  only_on_map 
)

Definition at line 199 of file lua_api.cpp.

References luaL_typerror(), and luaW_tounit().

Referenced by game_lua_kernel::intf_teleport().

bool luaW_pcall ( lua_State L,
int  nArgs,
int  nRets,
bool  allow_wml_error = false 
)
lua_unit* luaW_pushlocalunit ( lua_State L,
unit u 
)
unit* luaW_tounit ( lua_State L,
int  index,
bool  only_on_map 
)
unit_ptr luaW_tounit_ptr ( lua_State L,
int  index,
bool  only_on_map 
)

Similar to luaW_checkunit/luaW_tounit but returns a unit_ptr, use this instead of luaW_checkunit/luaW_tounit when uasing an api that needs unit_ptr.

Definition at line 191 of file lua_api.cpp.

References lua_unit::get_shared(), getunitKey, lua_touserdata(), luaW_hasmetatable(), and lua_unit::on_map().

Variable Documentation

lg::log_domain log_scripting_lua("scripting/lua")
static