Skip to main content

build_bp_from_script

Function build_bp_from_script 

Source
pub fn build_bp_from_script(script: &str) -> Result<Value>
Expand description

Run a .bp.lua DSL script (source text, not a file path) in a fresh mlua::Lua VM and return its result as serde_json::Value.

The script is expected to require("flow_dsl") and/or require("bp_dsl") and return a Blueprint-shaped (or Expr/Node -shaped, for narrower scripts) Lua table as its last expression.

Empty Lua tables are treated as empty JSON arrays rather than empty objects (encode_empty_tables_as_array) — every plain empty table this DSL can emit is a Node/Expr list field (seq.children, and.args, or.args), never a legitimately-empty JSON object. A field that must serialize as an empty JSON object uses the F.obj() marker (flow_dsl.lua) instead of a bare {} table literal; this function replaces every occurrence of that marker with a genuine empty JSON object as a post-pass (replace_empty_object_markers) over the converted value.