extract the base portion of a pathname.
luarocks install basename
extract the base portion of a pathname.
Parameters
pathname:string
: pathname string.
Returns
name:string
: the base portion of a pathname.
Example
local basename = require('basename')
print(basename('/foo/bar/baz.qux')) -- 'baz.qux'
-- the trailing-slashes will be deleted.
print(basename('///usr///bin///')) -- 'bin'