lua_提取路径中包含的文件名

function QMPlugin.GetFileName(path)
  sh_init()
  local iRet, sRet = pcall(function()
    path = "/" .. path
    local ret
    for w in string.gmatch(path, "/([^/]+)") do
      ret = w
    end
    return ret
  end)
  if iRet == true then
    return sRet
  else
    print(sRet)
    return ""
  end
end

 

赞 (0)