#include "builder.hpp" namespace Bezos { Deck load(const std::string& file) { using L = sol::lib; sol::state lua; lua.open_libraries( L::base, L::package, L::coroutine, L::string, L::os, L::math, L::table, L::debug, L::io, L::ffi, L::jit); lua.new_enum("NodeType",{ {"TEXT", NodeType::TEXT}, {"H1", NodeType::H1}, {"IMAGE", NodeType::IMAGE}, {"UL", NodeType::UL}, {"ERROR", NodeType::ERROR}, }); lua.new_usertype("Color", sol::constructors(), "r", &Color::r, "g", &Color::g, "b", &Color::b, "a", &Color::a); lua.new_usertype("Builder", "slide_start", &Builder::slide_start, "slide_config", &Builder::slide_config, "config_set", &Builder::config_set, "node_add", &Builder::node_add); lua.script_file(file); Builder builder = lua["DECK"]; return builder.deck; } void dump(Deck& deck) { for(auto& slide : deck.slides) { fmt::println("-----"); for(auto& node : slide.content) { fmt::println("node: {},{}", (int)node.type, node.content); } } } }