create defines to support encounter index ratios

This commit is contained in:
garak
2019-07-01 23:47:45 -04:00
parent adb0a44457
commit 4594c955b4
3 changed files with 14 additions and 7 deletions

View File

@@ -5,7 +5,7 @@
#include <map>
#include <string>
using std::string;
using std::string; using std::to_string;
#include <inja.hpp>
using namespace inja;
@@ -53,6 +53,13 @@ int main(int argc, char *argv[])
return "";
});
env.add_callback("setVarInt", 2, [=](Arguments& args) {
string key = args.at(0)->get<string>();
string value = to_string(args.at(1)->get<int>());
set_custom_var(key, value);
return "";
});
env.add_callback("getVar", 1, [=](Arguments& args) {
string key = args.at(0)->get<string>();
return get_custom_var(key);