title: “file::include Function Documentation” author: “laplante@plcb.ca” date: “2023” version: “1.0.0”
file::include Include and execute files in the current context.
file::include or include(file[, file…, reload:bool, error: variable])
This function includes a file into the current context.
true
./
, the system will prepend the docroot
(if defined).res={{
template := "../../tests/038-file/template10";
file := "../../tests/038-file/binary10";
temp := "../../tests/038-file/temp10";
generate(template:template, file:file, compile:true, save:temp);
include(file);
"After include file\n";
f10(4);
"end of code\n";
}}endtest.
// with template10
Template10
{{
func f10(i) {
"A"; i * 2;
}
"execution of template"; f10(5);
}}
\{{
func f10(i) {
"B"; i * 2;
}
f10(5);
}}endtemplate10.
res=Template10
execution of templateA10
B10endtemplate10.
After include file
B8end of code
endtest.
laplante@plcb.ca