lua で path を 分解する
local segments = {} local path = '/foo/bar/hoge/piyo' for segment in string.gmatch(path, "[^/\\]+") do table.insert(segments, segment) end for _, segment in pairs(segments) do print(segment) end -- foo -- bar -- hoge -- piyo