diff options
author | Case Duckworth | 2024-03-10 21:39:53 -0500 |
---|---|---|
committer | Case Duckworth | 2024-03-10 21:39:53 -0500 |
commit | a72ff678da253fce46e8e4648f6e4cf5ce1ea9b4 (patch) | |
tree | a82501fca97f4adc272d05145548d10cabe3ea2a /pp.lua | |
parent | Ugghhhh totally not working (diff) | |
download | lam-a72ff678da253fce46e8e4648f6e4cf5ce1ea9b4.tar.gz lam-a72ff678da253fce46e8e4648f6e4cf5ce1ea9b4.zip |
uh new start
Diffstat (limited to 'pp.lua')
-rw-r--r-- | pp.lua | 26 |
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 | ||
3 | local pp = {} | 3 | local pp = {} |
4 | table.unpack = table.unpack or unpack | 4 | local type = require "type" |
5 | 5 | local unpack = table.unpack or unpack | |
6 | pp.luadump = | ||
7 | function (x) | ||
8 | end | ||
9 | |||
10 | pp.luapp = function (x) print(pp.luadump(x)) end | ||
11 | |||
12 | pp.lamdump = | ||
13 | function (x) | ||
14 | end | ||
15 | |||
16 | pp.lampp = function (x) print(pp.lamdump(x)) end | ||
17 | |||
18 | -- The following should be at some point replaced by the preceding | ||
19 | 6 | ||
20 | function pp.dump (x, lvl) | 7 | function 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)) |
47 | end | 34 | end |
48 | 35 | ||
49 | return setmetatable(pp, { __call = | 36 | --- |
50 | function(_, x) | 37 | return pp |
51 | return pp.pp(x) | ||
52 | end, | ||
53 | }) | ||