Input handles

From ComputerCraft
Jump to navigation Jump to search
FunctionFunctionHandle.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

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

Handle.readLine