|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file:
-- http://anggtwu.net/LUA/PathTo1.lua.html
-- http://anggtwu.net/LUA/PathTo1.lua
-- (find-angg "LUA/PathTo1.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- (find-blogme3 "blogme3.lua" "pathto")
-- (find-blogme3grep "grep --color=auto -nH --null -e pathtoroot *.lua")
-- (defun e () (interactive) (find-angg "LUA/PathTo1.lua"))
PathTo = Class {
type = "PathTo",
outputfile = function (outputfile)
local _,nslashes = string.gsub(outputfile, "/", "/")
local root = string.rep("../", nslashes)
return PathTo {outputfile=outputfile, nslashes=nslashes, root=root}
end,
__call = function (pt, file) return pt.root .. file end,
__tostring = mytostring,
__index = {
},
}
--[[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "PathTo1.lua"
pathto = PathTo.outputfile("foo/bar/plic.html")
= pathto
= pathto("bletch.html")
= pathto("foo/blop.html")
= pathto("foo/bar/ploc.html")
--]]
-- Local Variables:
-- coding: utf-8-unix
-- End: