The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Functions
lua_api.hpp File Reference
#include <cstddef>
#include <string>
#include "lua_types.hpp"
#include "units/ptr.hpp"
Include dependency graph for lua_api.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  lua_unit
 Storage for a unit, either owned by the Lua code (ptr != 0), a local variable unit (c_ptr != 0), on a recall list (side != 0), or on the map. More...
 

Functions

unitluaW_tounit (lua_State *L, int index, bool only_on_map=false)
 Converts a Lua value to a unit pointer. More...
 
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=false)
 Calls a Lua function stored below its nArgs arguments at the top of the stack. More...
 
unitluaW_checkunit (lua_State *L, int index, bool only_on_map=false)
 Converts a Lua value to a unit pointer. More...
 
lua_unitluaW_pushlocalunit (lua_State *L, unit &u)
 
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)
 

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 = false 
)
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 = false 
)
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().