當前位置:首頁 » 操作系統 » 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-07-05 16:10:30 瀏覽:515
微博資料庫設計 發布:2025-07-05 15:30:55 瀏覽:19
linux485 發布:2025-07-05 14:38:28 瀏覽:299
php用的軟體 發布:2025-07-05 14:06:22 瀏覽:750
沒有許可權訪問計算機 發布:2025-07-05 13:29:11 瀏覽:425
javaweb開發教程視頻教程 發布:2025-07-05 13:24:41 瀏覽:685
康師傅控流腳本破解 發布:2025-07-05 13:17:27 瀏覽:233
java的開發流程 發布:2025-07-05 12:45:11 瀏覽:678
怎麼看內存卡配置 發布:2025-07-05 12:29:19 瀏覽:277
訪問學者英文個人簡歷 發布:2025-07-05 12:29:17 瀏覽:828