The Battle for Wesnoth
1.17.23+dev
scripting
lua_formula_bridge.hpp
Go to the documentation of this file.
1
/*
2
Copyright (C) 2017 - 2023
3
Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY.
11
12
See the COPYING file for more details.
13
*/
14
15
#pragma once
16
17
#include <memory>
18
#include <string>
19
20
struct
lua_State;
21
22
namespace
wfl
{
23
class
formula;
24
class
function_symbol_table;
25
class
formula_debugger;
26
class
formula_callable;
27
class
variant;
28
}
29
30
namespace
lua_formula_bridge
{
31
32
int
intf_eval_formula
(lua_State*);
33
int
intf_compile_formula
(lua_State*);
34
std::string
register_metatables
(lua_State*);
35
36
class
fwrapper
{
37
std::shared_ptr<wfl::formula>
formula_ptr
;
38
public
:
39
fwrapper
(
const
std::string& code,
wfl::function_symbol_table
* functions =
nullptr
);
40
std::string
str
()
const
;
41
wfl::variant
evaluate
(
const
wfl::formula_callable
& variables,
wfl::formula_debugger
* fdb =
nullptr
)
const
;
42
};
43
44
}
// end namespace lua_formula_bridge
lua_formula_bridge::fwrapper
Definition:
lua_formula_bridge.hpp:36
lua_formula_bridge::fwrapper::str
std::string str() const
Definition:
lua_formula_bridge.cpp:274
lua_formula_bridge::fwrapper::evaluate
wfl::variant evaluate(const wfl::formula_callable &variables, wfl::formula_debugger *fdb=nullptr) const
Definition:
lua_formula_bridge.cpp:282
lua_formula_bridge::fwrapper::formula_ptr
std::shared_ptr< wfl::formula > formula_ptr
Definition:
lua_formula_bridge.hpp:37
lua_formula_bridge::fwrapper::fwrapper
fwrapper(const std::string &code, wfl::function_symbol_table *functions=nullptr)
Definition:
lua_formula_bridge.cpp:269
wfl::formula_callable
Definition:
callable.hpp:30
wfl::formula_debugger
Definition:
debugger.hpp:74
wfl::function_symbol_table
Definition:
function.hpp:233
wfl::variant
Definition:
variant.hpp:29
lua_formula_bridge
Definition:
lua_formula_bridge.hpp:30
lua_formula_bridge::register_metatables
std::string register_metatables(lua_State *)
Definition:
lua_formula_bridge.cpp:305
lua_formula_bridge::intf_compile_formula
int intf_compile_formula(lua_State *)
Definition:
lua_formula_bridge.cpp:259
lua_formula_bridge::intf_eval_formula
int intf_eval_formula(lua_State *)
Evaluates a formula in the formula engine.
Definition:
lua_formula_bridge.cpp:227
wfl
Definition:
contexts.hpp:44
Generated by
1.9.1