#include "scripting/lua_formula_bridge.hpp"
#include "game_board.hpp"
#include "scripting/lua_unit.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_team.hpp"
#include "scripting/lua_unit_attacks.hpp"
#include "scripting/lua_unit_type.hpp"
#include "lua/wrapper_lauxlib.h"
#include "formula/callable_objects.hpp"
#include "formula/formula.hpp"
#include "variable.hpp"
#include "resources.hpp"
#include "units/map.hpp"
#include "units/unit.hpp"
Go to the source code of this file.
Classes | |
class | lua_callable |
Functions | |
void | luaW_pushfaivariant (lua_State *L, variant val) |
variant | luaW_tofaivariant (lua_State *L, int i) |
lua_formula_bridge::fpointer | luaW_check_formula (lua_State *L, int idx, bool allow_str) |
Get a formula from the stack. More... | |
static int | impl_formula_collect (lua_State *L) |
static int | impl_formula_tostring (lua_State *L) |
Variables | |
static const char | formulaKey [] = "formula" |
|
static |
Definition at line 302 of file lua_formula_bridge.cpp.
Referenced by lua_formula_bridge::register_metatables().
|
static |
Definition at line 309 of file lua_formula_bridge.cpp.
References lua_formula_bridge::fwrapper::str().
Referenced by lua_formula_bridge::register_metatables().
lua_formula_bridge::fpointer luaW_check_formula | ( | lua_State * | L, |
int | idx, | ||
bool | allow_str | ||
) |
Get a formula from the stack.
If allow_str is true, it compiles a formula string if found. Otherwise, it must be an already-compiled formula. Raises an error if a formula is not found, or if there's an error in compilation. Thus, it never returns a null pointer.
Definition at line 226 of file lua_formula_bridge.cpp.
References formulaKey, and luaW_type_error().
Referenced by lua_formula_bridge::intf_eval_formula().
void luaW_pushfaivariant | ( | lua_State * | L, |
variant | val | ||
) |
Definition at line 122 of file lua_formula_bridge.cpp.
References wfl::variant::as_callable(), wfl::variant::as_decimal(), wfl::variant::as_int(), wfl::variant::as_list(), wfl::variant::as_map(), wfl::variant::as_string(), unit_map::find(), resources::gameboard, unit::get_location(), wfl::variant::is_callable(), wfl::variant::is_decimal(), wfl::variant::is_int(), wfl::variant::is_list(), wfl::variant::is_map(), wfl::variant::is_null(), wfl::variant::is_string(), luaW_pushlocation(), luaW_pushteam(), luaW_pushunit(), luaW_pushunittype(), luaW_pushweapon(), unit::side(), t, wfl::variant::try_convert(), unit::underlying_id(), game_board::units(), and wfl::write_only.
Referenced by lua_formula_bridge::intf_eval_formula().
variant luaW_tofaivariant | ( | lua_State * | L, |
int | i | ||
) |
Definition at line 186 of file lua_formula_bridge.cpp.
References wfl::variant::DECIMAL_VARIANT, vconfig::get_parsed_config(), i, luaW_tolocation(), luaW_toteam(), luaW_totstring(), luaW_tounit(), luaW_tounittype(), luaW_tovconfig(), luaW_toweapon(), t_string::str(), t, and vconfig::unconstructed_vconfig().
Referenced by lua_callable::get_value().
|
static |
Definition at line 32 of file lua_formula_bridge.cpp.
Referenced by lua_formula_bridge::intf_compile_formula(), luaW_check_formula(), and lua_formula_bridge::register_metatables().