Skip to main content

convert_sectioned_file

Function convert_sectioned_file 

Source
pub fn convert_sectioned_file(
    content: &str,
    sections_refs: &HashMap<String, Vec<S2sRefType>>,
) -> String
Expand description

Convert a sectioned .s2s file (with //~ markers) to a Lua module.

The output is a Lua file that returns a table keyed by section name. Text sections (referenced by msgbox) become strings. Script sections (referenced by button, addscript, etc.) become transpiled Lua functions. Sections not referenced at all are transpiled as scripts.