The Battle for Wesnoth  1.19.7+dev
Classes | Typedefs | Functions
lua_formula_bridge Namespace Reference

Classes

class  fwrapper
 

Typedefs

using fpointer = std::unique_ptr< fwrapper, std::function< void(fwrapper *)> >
 

Functions

int intf_eval_formula (lua_State *)
 Evaluates a formula in the formula engine. More...
 
int intf_compile_formula (lua_State *)
 
std::string register_metatables (lua_State *)
 

Typedef Documentation

◆ fpointer

using lua_formula_bridge::fpointer = typedef std::unique_ptr<fwrapper, std::function<void(fwrapper*)> >

Definition at line 45 of file lua_formula_bridge.hpp.

Function Documentation

◆ intf_compile_formula()

int lua_formula_bridge::intf_compile_formula ( lua_State *  L)

Definition at line 271 of file lua_formula_bridge.cpp.

References formulaKey, and luaW_type_error().

Referenced by lua_kernel_base::lua_kernel_base().

◆ intf_eval_formula()

int lua_formula_bridge::intf_eval_formula ( lua_State *  L)

Evaluates a formula in the formula engine.

  • Arg 1: Formula string.
  • Arg 2: optional context; can be a unit or a Lua table.
  • Ret 1: Result of the formula.

Definition at line 249 of file lua_formula_bridge.cpp.

References luaW_check_formula(), luaW_pushfaivariant(), luaW_toteam(), luaW_tounit(), luaW_tounittype(), luaW_toweapon(), and t.

Referenced by lua_kernel_base::lua_kernel_base(), and register_metatables().

◆ register_metatables()

std::string lua_formula_bridge::register_metatables ( lua_State *  L)