about summary refs log tree commit diff stats
path: root/pp.lua
diff options
context:
space:
mode:
authorCase Duckworth2024-03-10 21:39:53 -0500
committerCase Duckworth2024-03-10 21:39:53 -0500
commita72ff678da253fce46e8e4648f6e4cf5ce1ea9b4 (patch)
treea82501fca97f4adc272d05145548d10cabe3ea2a /pp.lua
parentUgghhhh totally not working (diff)
downloadlam-a72ff678da253fce46e8e4648f6e4cf5ce1ea9b4.tar.gz
lam-a72ff678da253fce46e8e4648f6e4cf5ce1ea9b4.zip
uh new start
Diffstat (limited to 'pp.lua')
-rw-r--r--pp.lua26
1 files changed, 5 insertions, 21 deletions
diff --git a/pp.lua b/pp.lua index 9c1a6d0..4d9d9af 100644 --- a/pp.lua +++ b/pp.lua
@@ -1,21 +1,8 @@
1--- lam.pp 1--- lam.pp
2 2
3local pp = {} 3local pp = {}
4table.unpack = table.unpack or unpack 4local type = require "type"
5 5local unpack = table.unpack or unpack
6pp.luadump =
7 function (x)
8 end
9
10pp.luapp = function (x) print(pp.luadump(x)) end
11
12pp.lamdump =
13 function (x)
14 end
15
16pp.lampp = function (x) print(pp.lamdump(x)) end
17
18-- The following should be at some point replaced by the preceding
19 6
20function pp.dump (x, lvl) 7function pp.dump (x, lvl)
21 lvl = lvl or 0 8 lvl = lvl or 0
@@ -23,7 +10,7 @@ function pp.dump (x, lvl)
23 local output = "" 10 local output = ""
24 --[[if getmetatable(x) and getmetatable(x).__tostring then 11 --[[if getmetatable(x) and getmetatable(x).__tostring then
25 output = output .. tostring(x) 12 output = output .. tostring(x)
26 else]]if type(x) == "table" then 13 else]]if type.luatype(x) == "table" then
27 local subo = "" 14 local subo = ""
28 for k,v in pairs(x) do 15 for k,v in pairs(x) do
29 if v == x then 16 if v == x then
@@ -46,8 +33,5 @@ function pp.pp (x)
46 print(pp.dump(x)) 33 print(pp.dump(x))
47end 34end
48 35
49return setmetatable(pp, { __call = 36---
50 function(_, x) 37return pp
51 return pp.pp(x)
52 end,
53})