From 0489456a4efa512677dd7d27f1ca5b90b19c6a68 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 21 Sep 2017 21:15:37 -0700 Subject: Fixed lua block vars. --- nomsu.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'nomsu.lua') diff --git a/nomsu.lua b/nomsu.lua index 9b1856c..76992a2 100644 --- a/nomsu.lua +++ b/nomsu.lua @@ -754,19 +754,21 @@ do end local inner_vars = setmetatable({ }, { __index = function(_, key) - return error("vars[" .. tostring(repr(key)) .. "]") + return "vars[" .. tostring(repr(key)) .. "]" end }) - return "do\n" .. self:tree_to_value(vars.lua_code, inner_vars) .. "\nend", true + local lua = self:tree_to_value(vars.lua_code, inner_vars) + return "do\n" .. tostring(lua) .. "\nend", true end) self:defmacro("lua expr %lua_code", function(self, vars, kind) local lua_code = vars.lua_code.value local inner_vars = setmetatable({ }, { __index = function(_, key) - return error("vars[" .. tostring(repr(key)) .. "]") + return "vars[" .. tostring(repr(key)) .. "]" end }) - return self:tree_to_value(vars.lua_code, inner_vars) + local lua = self:tree_to_value(vars.lua_code, inner_vars) + return lua end) self:def("require %filename", function(self, vars) if not self.loaded_files[vars.filename] then -- cgit v1.2.3