|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- fbpp.lua: pretty-print lua tables (from FB json) as compilable lua code
-- This file:
-- http://angg.twu.net/fbcache/fbpp.lua
-- http://angg.twu.net/fbcache/fbpp.lua.html
-- (find-angg "fbcache/fbpp.lua")
-- 2016jan09
-- (find-fbcache "fbcache.lua" "requires")
userocks() -- (find-angg "LUA/lua50init.lua" "userocks")
pretty = require 'pl.pretty' -- (find-es "lua5" "pl.pretty")
pp0 = function (o) return pretty.write(o) end
pp = function (o) print(pretty.write(o)) end
-- (find-es "lua5" "pl.pretty-fix")
longquote = function (str)
local T = {}
local f = function (eqs) T[#eqs+1] = 1 end
if str:gsub("%](=*)", f) then
local eqs = string.rep("=", #T)
return '['..eqs..'[\n'..str..']'..eqs..']'
end
return '[[\n'..str..']]'
end
-- (find-es "lua5" "pl.text.wrap")
wrap = (require "pl.text").wrap
wraps = function (bigstr)
local f = function (li) return table.concat(wrap(li), "\n").."\n" end
return (bigstr:gsub("([^\n]+)", f))
end
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "fbpp.lua"
pp {2, 3, 4}
--]]
-- Local Variables:
-- coding: raw-text-unix
-- End: