aboutsummaryrefslogtreecommitdiff
path: root/nomsu_compiler.lua
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-01-01 15:52:56 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-01-01 15:53:21 -0800
commita82b0d9d2435cca72629c1e5e73cdcb89f728ac0 (patch)
tree638cd1b321dde44e200d3346e5b6fd0152774470 /nomsu_compiler.lua
parentb6d3cbd61cd08e39d20a569b7c5ece6bb25897dd (diff)
Added support for $(foo 1 baz 2) as a way to access (foo 1 baz 2)'s
meaning.
Diffstat (limited to 'nomsu_compiler.lua')
-rw-r--r--nomsu_compiler.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/nomsu_compiler.lua b/nomsu_compiler.lua
index 2b49112..c9f8fd6 100644
--- a/nomsu_compiler.lua
+++ b/nomsu_compiler.lua
@@ -473,7 +473,12 @@ local compile = setmetatable({
elseif "Number" == _exp_0 then
return LuaCode:from(tree.source, tostring(tree[1]))
elseif "Var" == _exp_0 then
- return LuaCode:from(tree.source, (concat(tree, " ")):as_lua_id())
+ if type(tree[1]) == 'string' then
+ return LuaCode:from(tree.source, (concat(tree, " ")):as_lua_id())
+ else
+ assert(tree[1].type == 'Action')
+ return LuaCode:from(tree.source, tree[1]:get_stub():as_lua_id())
+ end
elseif "FileChunks" == _exp_0 then
return error("Can't convert FileChunks to a single block of lua, since each chunk's " .. "compilation depends on the earlier chunks")
elseif "Comment" == _exp_0 then