mirror of
https://github.com/TangentFoxy/etlua.git
synced 2025-07-27 18:42:17 +00:00
expose _G
This commit is contained in:
@@ -132,7 +132,12 @@ class Parser
|
||||
|
||||
fn = assert load(code_fn, name)
|
||||
(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
|
||||
|
||||
-- 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
|
||||
|
Reference in New Issue
Block a user