40 return luaL_argerror(L, 1,
"get_direction: first argument(S) must be a location");
43 if (nargs != 2 and nargs != 3) {
45 msg += std::to_string(nargs);
64 std::string msg(
"get_direction: second argument should be a direction, either a string or an integer, instead found a ");
121 lua_pushstring(L,
"rotate_right_around_center: requires two locations");
157 for (
int i = 0;
i < 6; ++
i) {
236 luaL_argerror(L, -1,
"error: must be an integer from 0 to 5");
static DIRECTION parse_direction(const std::string &str)
int intf_vector_zero(lua_State *L)
Expose map_location::ZERO to lua.
LUA_API int lua_type(lua_State *L, int idx)
LUA_API void lua_pushboolean(lua_State *L, int b)
map_location rotate_right_around_center(const map_location ¢er, int k) const
void get_adjacent_tiles(const map_location &a, map_location *res)
Function which, given a location, will place all adjacent locations in res.
int intf_get_direction(lua_State *L)
Expose map_location::get_direction function to lua Arg 1: a location Arg 2: a direction Arg 3: number...
LUA_API int lua_gettop(lua_State *L)
static const map_location & ZERO()
Old implementation:
DIRECTION get_relative_dir(const map_location &loc, map_location::RELATIVE_DIR_MODE mode) const
int intf_distance_between(lua_State *L)
Expose map_location distance_between.
int intf_rotate_right_around_center(lua_State *L)
Expose map_location::rotate_right_around_center to lua.
int intf_parse_direction(lua_State *L)
Expose map_location parse_direction.
int intf_get_relative_dir(lua_State *L)
Expose map_location get_relative_dir.
bool tiles_adjacent(const map_location &a, const map_location &b)
Function which tells if two locations are adjacent.
LUA_API int lua_isstring(lua_State *L, int idx)
size_t distance_between(const map_location &a, const map_location &b)
Function which gives the number of hexes between two tiles (i.e.
Templates and utility-routines for strings and numbers.
int intf_tiles_adjacent(lua_State *L)
Expose map_location tiles_adjacent.
Encapsulates the map of the game.
int intf_vector_negation(lua_State *L)
Expose map_location::vector_negation to lua.
int intf_write_direction(lua_State *L)
Expose map_location write_direction.
static DIRECTION rotate_right(DIRECTION d, unsigned int k=1u)
Inlined bodies.
int intf_get_in_basis_N_NE(lua_State *L)
Expose map_location get_in_basis_N_NE.
LUALIB_API int luaL_argerror(lua_State *L, int narg, const char *extramsg)
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
DIRECTION
Valid directions which can be moved in our hexagonal world.
GLdouble GLdouble GLdouble r
int intf_get_adjacent_tiles(lua_State *L)
Expose map_location get_adjacent_tiles.
LUA_API int lua_isnumber(lua_State *L, int idx)
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
map_location & vector_sum_assign(const map_location &a)
int intf_vector_sum(lua_State *L)
Expose map_location::vector_sum to lua.
#define luaL_checkint(L, n)
LUA_API int lua_error(lua_State *L)
std::pair< int, int > get_in_basis_N_NE() const
void luaW_pushlocation(lua_State *L, const map_location &ml)
Converts a map location object to a Lua table pushed at the top of the stack.
map_location get_direction(DIRECTION d, unsigned int n=1u) const
map_location vector_negation() const
Inline vector ops.
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
static std::string write_direction(DIRECTION dir)
GLsizei const GLcharARB ** string
LUA_API const char * lua_pushstring(lua_State *L, const char *s)
bool luaW_tolocation(lua_State *L, int index, map_location &loc)
Converts an optional table or pair of integers to a map location object.
LUA_API const char * lua_typename(lua_State *L, int t)
#define luaL_checkstring(L, n)