mirror of
https://github.com/TangentFoxy/etlua.git
synced 2025-07-28 02:52:17 +00:00
add compile_to_lua helper function
This commit is contained in:
@@ -199,6 +199,11 @@ class Parser
|
||||
setfenv fn, combined_env
|
||||
fn buffer, #buffer, tostring, concat, html_escape
|
||||
|
||||
compile_to_lua: (str) =>
|
||||
success, err = @parse str
|
||||
return nil, err unless success
|
||||
@chunks_to_lua!
|
||||
|
||||
-- generates the code of the template
|
||||
chunks_to_lua: =>
|
||||
-- todo: find a no-conflict name for locals
|
||||
|
Reference in New Issue
Block a user