Complete the code to read the contents of a file named "config.txt".
content = file("[1]")
file with templatefile.The file function reads the entire content of the specified file. Here, the file name is "config.txt".
Complete the code to load a template file named "server.tpl".
template_content = templatefile("[1]", { port = 8080 })
templatefile.The templatefile function loads a template file. Here, the file is "server.tpl".
Fix the error in the code to correctly read a file named "data.json".
data = file([1])The file function requires the file path as a quoted string. So, use double quotes around "data.json".
Fill both blanks to read a template file "app.tpl" and pass the variable "version" with value "1.2.3".
app_config = templatefile("[1]", { [2] = "1.2.3" })
The first blank is the template file name "app.tpl". The second blank is the variable name "version" passed to the template.
Fill all three blanks to read a file "settings.conf", read a template "deploy.tpl", and pass variable "env" with value "prod".
settings = file("[1]") deploy_script = templatefile("[2]", { [3] = "prod" })
file and templatefile.The first blank is the file name "settings.conf" for the file function. The second blank is the template file "deploy.tpl". The third blank is the variable name "env" passed to the template.