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

熱點內容
app什麼情況下找不到伺服器 發布:2025-05-12 15:46:25 瀏覽:714
php跳過if 發布:2025-05-12 15:34:29 瀏覽:467
不定時演算法 發布:2025-05-12 15:30:16 瀏覽:131
c語言延時1ms程序 發布:2025-05-12 15:01:30 瀏覽:165
動物園靈長類動物配置什麼植物 發布:2025-05-12 14:49:59 瀏覽:734
wifi密碼設置什麼好 發布:2025-05-12 14:49:17 瀏覽:148
三位數乘兩位數速演算法 發布:2025-05-12 13:05:48 瀏覽:397
暴風影音緩存在哪裡 發布:2025-05-12 12:42:03 瀏覽:541
access資料庫exe 發布:2025-05-12 12:39:04 瀏覽:628
五開的配置是什麼 發布:2025-05-12 12:36:37 瀏覽:365