lua遍历文件
来源:互联网 发布:苹果软件开发前景 编辑:程序博客网 时间:2024/06/05 12:43
主要是利用这个luaforwindows的这个软件来执行下面这些代码,把遍历目录得到的每一个路径都存在一个table里面,然后遍历这个table就能把每条目录都打印出来
--dofile("c:\\Users\\Amber\\Desktop\\a.lua")require "lfs"function getpathes(rootpath, pathes) pathes = pathes or {} ret, files, iter = pcall(lfs.dir, rootpath) if ret == false then return pathes end for entry in files, iter do local next = false if entry ~= '.' and entry ~= '..' then local path = rootpath .. '/' .. entry local attr = lfs.attributes(path) if attr == nil then next = true end if next == false then if attr.mode == 'directory' then getpathes(path, pathes) else table.insert(pathes, path) end end end next = false end return pathesendpathes = {}pathes = getpathes("c:/Users/Amber/Desktop/src", pathes)for key, path in pairs(pathes) do print(key .. "==" .. path)end
0 0
- lua遍历文件
- 【Lua】使用lfs遍历文件目录
- 遍历和读取LUA文件中表的元素Demo
- Lua遍历数组
- lua table 遍历
- Lua 中Table遍历
- lua遍历文件夹
- 遍历Lua全局环境变量
- lua 遍历 table
- Lua--table的遍历
- lua table 遍历
- lua遍历table
- lua遍历table方式
- lua遍历文件夹
- lua for遍历
- lua中的table遍历
- Lua 深入浅出 遍历
- lua 读取lua文件
- java中怎么写一个webservice
- leetcode 题解 || Search for a Range 问题
- 12个你未必知道的CSS小知识
- 求强连通分量的双DFS,Tarjan和Gobow算法详解
- ASPXGridView控件使用日记(SelectAllRowsOnPage)
- lua遍历文件
- LInux下操作命令之一
- ios内存管理
- copy那点事儿
- linux 高并发socket通信模型
- golang 上传文件到php
- MapReduce中map任务个数的确定
- B. Tanya and Postcard
- android PreferenceScreen preference偏好显示类的使用介绍