89 template<
typename... Args>
115 template<
typename... Args>
Storage for a unit, either owned by the Lua code (ptr != 0), a local variable unit (c_ptr !...
lua_unit & operator=(const lua_unit &)=delete
unit * operator->() const
lua_unit(int s, std::size_t u)
friend lua_unit * luaW_pushunit(lua_State *L, Args... args)
static void setmetatable(lua_State *L)
bool put_map(const map_location &loc)
int on_recall_list() const
friend lua_unit * luaW_pushlocalunit(lua_State *L, unit &u)
Pushes a private unit on the stack.
unit_ptr get_shared() const
lua_unit(const lua_unit &)=delete
This class represents a single unit of a specific type.
lua_unit * luaW_checkunit_ref(lua_State *L, int index)
Similar to luaW_checkunit but returns a lua_unit; use this if you need to handle map and recall units...
unit * luaW_tounit(lua_State *L, int index, bool only_on_map=false)
Converts a Lua value to a unit pointer.
lua_unit * luaW_tounit_ref(lua_State *L, int index)
Similar to luaW_tounit but returns a lua_unit; use this if you need to handle map and recall units di...
lua_unit * luaW_pushunit(lua_State *L, Args... args)
unit & luaW_checkunit(lua_State *L, int index, bool only_on_map=false)
Converts a Lua value to a unit pointer.
bool luaW_isunit(lua_State *, int index)
Test if a Lua value is a unit.
unit_ptr luaW_checkunit_ptr(lua_State *L, int index, bool only_on_map)
Similar to luaW_checkunit but returns a unit_ptr; use this instead of luaW_checkunit when using an ap...
unit_ptr luaW_tounit_ptr(lua_State *L, int index, bool only_on_map)
Similar to luaW_tounit but returns a unit_ptr; use this instead of luaW_tounit when using an api that...
lua_unit * luaW_pushlocalunit(lua_State *L, unit &u)
Pushes a private unit on the stack.
std::string register_metatables(lua_State *L)
std::size_t index(std::string_view str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
std::shared_ptr< unit > unit_ptr
Encapsulates the map of the game.
static map_location::direction s