local lfs       = require("lfs")

function string.split(self, pat)
   pat  = pat or "%s+"
   local st, g = 1, self:gmatch("()("..pat..")")
   local function l_getter(self, segs, seps, sep, cap1, ...)
      st = sep and seps + #sep
      return self:sub(segs, (seps or 0) - 1), cap1 or sep, ...
   end
   local function l_splitter(self)
      if st then return l_getter(self, st, g()) end
   end
   return l_splitter, self
end

function main()

   local version = lfs._VERSION:lower():gsub("luafilesystem  *","")
   local factorA = { 1000000, 1000, 1}

   local idx = 0
   local num = 0
   for s in version:split("%.") do
      local i,j = s:find("%d+")
      s         = s:sub(i,j)
      idx = idx + 1
      num = (tonumber(s) or 0)*factorA[idx] + num
      if (idx >= #factorA) then break end
   end
   print(num)
end

main()
