From 65dc1f2196b46dbd527d49da113515bea825416d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 26 Jun 2018 15:52:38 -0700 Subject: Cleaning up metaprogramming a bit and fixing/adding test for recursion control flow. --- code_obj.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'code_obj.lua') diff --git a/code_obj.lua b/code_obj.lua index de62c8f..e3f7b16 100644 --- a/code_obj.lua +++ b/code_obj.lua @@ -297,6 +297,12 @@ do end return statements end, + as_expr = function(self) + if self.is_value then + return self + end + return error("Cannot convert to expression: " .. tostring(tostring(self))) + end, __tostring = function(self) if self.__str == nil then local buff, indents = { }, self.indents -- cgit v1.2.3