35 #define LOG_LUA LOG_STREAM(info, log_ai_engine_lua)
36 #define ERR_LUA LOG_STREAM(err, log_ai_engine_lua)
46 :
val_(
"Lua Function")
75 return std::vector<std::string>();
79 const int unit_x = (*unit).get_location().x + 1;
80 const int unit_y = (*unit).get_location().y + 1;
82 LOG_LUA <<
"Entering unit_advancements_aspect::get_advancements() in instance " <<
this <<
" with unit " << unit_id <<
" on (x,y) = (" << unit_x <<
", " << unit_y <<
")\n";
88 if (
val_ ==
"Lua Function")
90 return std::vector<std::string>();
105 ERR_LUA <<
"Can't evaluate advancement aspect: Value is neither a string nor a function." << std::endl;
106 return std::vector<std::string>();
120 return std::vector<std::string>();
124 ERR_LUA <<
"LUA Error while evaluating advancements_aspect: Function must return String " << std::endl;
125 return std::vector<std::string>();
132 LOG_LUA <<
"Called Lua advancement function. Result was: \"" << retval <<
"\".\n";
LUA_API void lua_rawgeti(lua_State *L, int idx, int n)
static lg::log_domain log_ai_engine_lua("ai/engine/lua")
LUA_API void lua_settop(lua_State *L, int idx)
LUALIB_API int luaL_ref(lua_State *L, int t)
GLuint const GLfloat * val
#define lua_pcall(L, n, r, f)
A small explanation about what's going on here: Each action has access to two game_info objects First...
LUA_API int lua_isstring(lua_State *L, int idx)
const std::vector< std::string > get_advancements(const unit_map::const_iterator &unit) const
#define lua_isfunction(L, n)
#define lua_tostring(L, i)
#define LUA_REGISTRYINDEX
Standard logging facilities (interface).
const std::string get_value() const
LUALIB_API void luaL_unref(lua_State *L, int t, int ref)
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
virtual ~unit_advancements_aspect()
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
GLsizei const GLcharARB ** string
unit_advancements_aspect()