當前位置:首頁 » 操作系統 » lua安裝linux

lua安裝linux

發布時間: 2024-05-13 21:45:25

linux平台:使用lua語言遍歷某一文件夾下所有文件

你可以參考如下實例代碼:

functiongetFile(file_name)
localf=assert(io.open(file_name,'r'))
localstring=f:read("*all")
f:close()
returnstring
endfunctionwriteFile(file_name,string)
localf=assert(io.open(file_name,'w'))
f:write(string)
f:close()
end--從命令行獲取參數,如果有參數則遍歷指定目錄,沒有參數遍歷當前目錄ifarg[1]~=nilthen
cmd="ls"..arg[1]
else
cmd="ls"endprint("cmd",cmd)
--io.popen返回的是一個FILE,跟c裡面的popen一樣locals=io.popen(cmd)
localfileLists=s:read("*all")
print(fileLists)
whiletruedo--從文件列表裡一行一行的獲取文件名_,end_pos,line=string.find(fileLists,"([^ ]+.txt)",start_pos)
ifnotend_posthenbreakend--print("wld",line)localstr=getFile(line)
--把每一行的末尾1,替換為0,localnew=string.gsub(str,"1, ","0, ");
--替換後的字元串寫入到文件。以前的內容會清空writeFile(line,new)
start_pos=end_pos+1end

㈡ Lua 的utf8庫及使用方法

a utf-8 support mole for Lua and LuaJIT
源碼地址: https://github.com/starwing/luautf8

編譯後可用的庫: https://github.com/cherishpf/luautf8
https://download.csdn.net/download/cherishpf/11579451
Linux版:lua-utf8.so
Windows版:lua-utf8.dll(若是用在openresty中,openresty版本需使用32位版本,使用64位版本時會報錯「lua-utf8.dll 不是有效的 Win32 應用程序」)
將lua-utf8庫放在openresty安裝目錄下,使用時用require引入。

㈢ linux怎麼卸載lua5.2

linux 中卸載軟體有多種方式:

  1. 如果是圖形界面, 可以使用應用商店卸載

  2. 命令行可以使用 apt-get remove 卸載, 在用apt-get autoremove 清除殘留

  3. 找到軟體安裝目錄下的卸載腳本卸載,然後將殘留文件刪除即可

  4. 其他方式可以參考readme文檔

熱點內容
phpredis工具 發布:2025-09-15 00:40:27 瀏覽:453
如何查詢水星路由器撥號密碼 發布:2025-09-15 00:21:06 瀏覽:308
存儲過程嵌套循環 發布:2025-09-15 00:15:24 瀏覽:666
什麼手游腳本好用 發布:2025-09-14 23:18:08 瀏覽:646
電腦主板和伺服器有什麼區別 發布:2025-09-14 23:16:33 瀏覽:116
android下載代碼 發布:2025-09-14 23:09:40 瀏覽:736
ftp拓展名 發布:2025-09-14 22:41:03 瀏覽:524
sql時間年月 發布:2025-09-14 22:40:00 瀏覽:809
web直播源碼 發布:2025-09-14 22:39:42 瀏覽:752
hibernate對象緩存 發布:2025-09-14 22:25:37 瀏覽:877