Advertisement
ozozx235

diskInfo.lua

May 27th, 2021
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. function getInfo()
  2.     if fs.isDir("disk") == false then
  3.         printError("no disk")
  4.         return
  5.     end
  6.     if fs.exists("disk/info.cfg") == false then
  7.         printError("no signature")
  8.         return
  9.     end
  10.     info = {}
  11.     info.name=""
  12.     info.comp=""
  13.     info.rel=""
  14.     info.vol=0
  15.     info.tpb= 0
  16.     for line in io.lines("disk/info.cfg") do
  17.         temp = string.match(line,"%a+:")
  18.         if temp == "Name:" then
  19.             temp2 = string.match(line,":.+")
  20.             info.name = string.sub(temp2,2,string.len(temp2))
  21.         end
  22.         if temp == "Composer:" then
  23.             temp2 = string.match(line,":.+")
  24.             info.comp = string.sub(temp2,2,string.len(temp2))
  25.         end
  26.         if temp == "Release:" then
  27.             temp2 = string.match(line,":.+")
  28.             info.rel = string.sub(temp2,2,string.len(temp2))
  29.         end
  30.         if temp == "VOL:" then
  31.             temp2 = string.match(line,":%d+")
  32.             info.vol = tonumber(string.sub(temp2,2,string.len(temp2)))
  33.         end
  34.         if temp == "TPB:" then
  35.             temp2 = string.match(line,":%d+")
  36.             info.tpb = tonumber(string.sub(temp2,2,string.len(temp2)))
  37.         end
  38.     end
  39.     return info
  40. end
  41.  
  42. --INF = getInfo()
  43. --print(INF.name.." by "..INF.comp)
  44. --print("Released "..INF.rel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement