1. Traverse all lua files under the file, This can be changed, only use luaforwindow to execute
–dofile(“F:/Program_Files/Lua/lua_script/csvtolua/get_csv.lua”)
require”lfs”
functionfindindir(path,wefind,r_table,intofolder )
for file in lfs.dir(path) do
If file~=”.” and file~= “..” then
local f = path.. ‘\\’..file
–print(“/t”..f)
if string.find(f, wefind) ~= nil then
–print(“/t”..f)
table.insert(r_table,f)
end end
local attr=lfs.attributes(f)
ass ert(type(attr)==”table”)
If attr.mode== “directory” and intofolder then
findindir (f, wefind, r_table, intofolder)
Else
–for name, value in pairs(attr) do
print (name, value)
end end span>
end
end
end
local currentFolder=[[F:\Program_Files\Lua\lua_script\csvtolua]]
—————— ——————-
local input_table={}
findindir(currentFolder, “%.lua”, input_table, false)–Find the lua file, you can change it here
i=1
while input_table[i]~=nil do
print(input_table[i])
i=i+1
end
This is the result of execution:< /span>
1. Traverse all the lua files under the file, this can be changed, you need to use luaforwindow to execute
< ol start="1" style="border-top:none;border-right:1px solid rgb(231,229,220);border-bottom:none;border-left:none;background-color:rgb(255,255,255);color:rgb (92,92,92);">
–dofile(“F:/Program_Files/Lua/lua_script/csvtolua/get_csv.lua”)
require”lfs”
functionfindindir(path,wefind,r_table,intofolder)
for file in lfs.dir(path) do
if file~=”.” and file~=”..”then
< li style="border-top:none;border-right:none;border-bottom:none;border-left:3px solid rgb(108,226,108);background-color:rgb(248,248,248);line-height:18px;list- style-position:outside;">local f = path..’\\’..file
–print (“/t”..f)
if string.find(f, wefind) ~= nil then
–print(“/t”..f)
table.insert(r_table,f)
end end
local attr=lfs.attributes(f)
assert (type(attr)==”table”) span>
Ifattr.mode==”directory”and intofolderthen /span>
findindir(f,wefind,r_table,intofolder) span>
else
–for name, value in pairs(attr) do do
print (name, value)
end end
< span style="border:none;color:#000000;background-color:inherit;">end end
end
end
local currentFolder=[[F:\Program_Files\Lua\lua_script\csvtolua]]
—————————- ———
local input_table = { }
findindir(currentFolder,”%.lua”, input_table, false)–Find the lua file, here you can change it
i=1
while input_table[i] ~=nil do
print(input_table[i])
i=i+ 1
end
< /ol>
This is the result of execution:
div>
–dofile(“F:/Program_Files/Lua/lua_script/csvtolua/get_csv.lua”)
require”lfs”
functionfindindir(path,wefind,r_table,intofolder)
for file in lfs.dir(path)
if file~=”.” and file~=”..” then
local f=path..’\\’..file < /li>
–p rint(“/t”..f)
if string.find(f, wefind) ~= nil then
Print(“/t”..f)
table.insert(r_table, f)
end end
local attr=lfs.attributes(f)
Assert (type(attr)==”table”)
ifattr.mode==”directory”and intofolderthen
findindir(f,wefind,r_table,intofolder)
< li style="border-top:none;border-right:none;border-bottom:none;border-left:3px solid rgb(108,226,108);background-color:rgb(248,248,248);line-height:18px;list- style-position:outside;"> else Else
–for name, value in pairs(attr) do
Print (name, value)
end end < /li>
end
end
end li>
local currentFolder = [[F:\Program_Files\Lua\lua_script\csvtolua]]
————————————-
local input_table = {}
findindir(currentFolder, “%.lua”, input_table, false)–查找lua文件,这里可以改的
i=1
while input_table[i]~=nil do
print(input_table[i])
i=i+1
end
[plain] view plain copy
Post navigation
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3237 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC