extract the directory part of a pathname.
luarocks install dirname
extract the directory part of a pathname.
Parameters
pathname:string
: pathname string.
Returns
dir:string
: the directory part of a pathname.
Example
local dirname = require('dirname')
-- the trailing-slash will be deleted.
local dir = dirname('///usr///bin///')
print(dir) -- '/usr'