當前位置:首頁 » 操作系統 » 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文檔

熱點內容
如何搭載我的世界伺服器 發布:2025-09-18 19:02:39 瀏覽:421
c語言組框 發布:2025-09-18 19:02:23 瀏覽:937
如何看見真我手機的全部配置 發布:2025-09-18 18:48:10 瀏覽:969
戰地5默認是什麼伺服器 發布:2025-09-18 17:59:32 瀏覽:304
安卓變ios系統主題怎麼弄 發布:2025-09-18 17:54:07 瀏覽:883
linux出口ip 發布:2025-09-18 17:51:57 瀏覽:944
androidbitmap使用 發布:2025-09-18 17:49:20 瀏覽:238
數字日期加密 發布:2025-09-18 17:43:46 瀏覽:503
網吧電腦顯示未連接上桌面伺服器 發布:2025-09-18 17:37:17 瀏覽:701
電腦壓縮文件怎麼解壓 發布:2025-09-18 17:27:59 瀏覽:391