Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- io.write("Hello world, from ",_VERSION,"!\n")
- print("Hello World!")
- file = io.open("C:\\temp\\1.txt")
- -- файл содержит:
- -- 1 1 1
- -- 2 2 2
- -- 3 3 3
- local database = { }
- d2 = { }
- if file then
- for line in file:lines() do
- local f = line
- print(f)
- table.insert(d2,f) -- пишем просто строку
- local n, a, e = line:match '(%S+)%s+(%S+)%s+(%S+)'
- table.insert(database, { x = n, y = a, z = e }) -- пишем индексы и значения
- print(n, a, e)
- end
- end
- x = 3
- y = 3
- z = 3
- for i = 1, #database do
- if string.match(database[i].x ,x) and string.match(database[i].y ,y) and string.match(database[i].z ,z) then
- print("match"..i)
- end
- --~ print(database[i].x,database[i].y,database[i].z)
- end
- --~ for k in io.popen([[dir "C:\temp" /b]]):lines() do print(k) end --выведет список файлов
- --~ for dir in io.popen([[dir "C:\temp" /b /ad]]):lines() do print(dir) end -- выведет список директорий
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement