Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
12
Task/File-input-output/Lua/file-input-output.lua
Normal file
12
Task/File-input-output/Lua/file-input-output.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
inFile = io.open("input.txt", "r")
|
||||
data = inFile:read("*all") -- may be abbreviated to "*a";
|
||||
-- other options are "*line",
|
||||
-- or the number of characters to read.
|
||||
inFile:close()
|
||||
|
||||
outFile = io.open("output.txt", "w")
|
||||
outfile:write(data)
|
||||
outfile:close()
|
||||
|
||||
-- Oneliner version:
|
||||
io.open("output.txt", "w"):write(io.open("input.txt", "r"):read("*a"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue