From bbaff0e0c204c2fab216f6501dc8c11b4425b4bc Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 4 Mar 2024 21:01:27 -0600 Subject: Ugghhhh totally not working --- pp.lua | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'pp.lua') diff --git a/pp.lua b/pp.lua index 85d323e..9c1a6d0 100644 --- a/pp.lua +++ b/pp.lua @@ -3,11 +3,27 @@ local pp = {} table.unpack = table.unpack or unpack +pp.luadump = + function (x) + end + +pp.luapp = function (x) print(pp.luadump(x)) end + +pp.lamdump = + function (x) + end + +pp.lampp = function (x) print(pp.lamdump(x)) end + +-- The following should be at some point replaced by the preceding + function pp.dump (x, lvl) lvl = lvl or 0 local space = string.rep(" ", lvl) local output = "" - if type(x) == "table" then + --[[if getmetatable(x) and getmetatable(x).__tostring then + output = output .. tostring(x) + else]]if type(x) == "table" then local subo = "" for k,v in pairs(x) do if v == x then @@ -20,10 +36,8 @@ function pp.dump (x, lvl) end output = output .. string.format("\n%s{%s\n%s}", space, subo, space) - elseif type(x) == "string" then - output = output .. string.format("'%s'", x) else - output = output .. string.format("%s", x) + output = output .. tostring(x) end return output end -- cgit 1.4.1-21-gabe81