Input handles

FunctionHandle.close
Frees a handle. Once closed, a handle can no longer be used.
Syntax Handle.close()
Returns nil
Part of CC:Tweaked
API handle

Handle.read

Functionhandle.readAll
Returns the full text of a file.
Syntax handle.readAll()
Returns string Text
Part of CC:Tweaked
API fs
ExamplePrint the content of the file "hello.lua"
Print the content of the file "/rom/programs/fun/hello.lua"
Code
<nowiki>
local handle = fs.open("/rom/programs/fun/hello.lua","r")
print(handle.readAll())
handle.close()
  </nowiki>
Output
if term.isColour() then
    term.setTextColour( 2^math.random(0,15) )
end
textutils.slowPrint( "Hello World!" )
term.setTextColour( colours.white )

Handle.readLine

This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.