mirror of
https://github.com/TangentFoxy/etlua.git
synced 2025-07-28 11:02:17 +00:00
expose _G
This commit is contained in:
@@ -132,7 +132,12 @@ class Parser
|
|||||||
|
|
||||||
fn = assert load(code_fn, name)
|
fn = assert load(code_fn, name)
|
||||||
(env={}) ->
|
(env={}) ->
|
||||||
setfenv fn, env
|
combined_env = setmetatable {}, __index: (name) =>
|
||||||
|
val = env[name]
|
||||||
|
val = _G[name] if val == nil
|
||||||
|
val
|
||||||
|
|
||||||
|
setfenv fn, combined_env
|
||||||
fn tostring, concat, html_escape
|
fn tostring, concat, html_escape
|
||||||
|
|
||||||
-- generates the code of the template
|
-- generates the code of the template
|
||||||
|
@@ -78,6 +78,13 @@ This is my message to <%= [=[oh yeah %>"]=] %>]]
|
|||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- should have access to _G
|
||||||
|
{
|
||||||
|
""
|
||||||
|
"<% assert(true) %>"
|
||||||
|
{ hello: "world" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for case in *cases
|
for case in *cases
|
||||||
|
Reference in New Issue
Block a user