Reference
templet.loadstring(s)
-
Loads a template from the given string, and returns a function.
That function takes as arguments
([env[, f]])
, and, when called, renders the template in the environment specified by the tableenv
, using the specified output functionf
. Ifenv
is nil, the global environment (_G
) is used. Iff
is nil, an output function equivalent tolocal result = {} local f = function(chunk) if chunk ~= nil then table.insert(result, tostring(chunk)) end end
is used, and the result of
table.concat(result)
is returned. templet.loadfile(filename)
-
Loads a template from the file with the given name, and returns a function as described above.