Posted 13 June 2012 - 07:16 PM
hello,
i've got a startupprogram that should work, but i don't get it working.
the error is a nil value error (think evereybody know wat it is) but i don't have any clue's any more.
my startupprogram search to a file called startupprogram.txt,
if it finds it, it shows the programname and after a few seconds it runs it.
at least it should run it.
it says that he can't index a nil value.
but i don't see any value that doesn't exist.
this is my startupprogram.
print("\n\n\n##################################################\n")
print("computercraft version; ", os.version())
print("Computer ID; ", os.computerID())
print("This computer is called; ", os.getComputerLabel())
lounchstartuppr=false
if fs.exists("startupprogram.txt") then
local file = fs.open("startupprogram.txt", "r")
whattodo = file.readAll()
file.close()
if whattodo ~= nil then
lounchstartuppr=true
print("opening on startup; ", whattodo)
else
print("file startupprogram.txt is not made proper")
end
else
print("opening on startup; -")
end
print("##################################################\n")
sleep(3)
print("going to execute")
if lounchstartuppr==true then
print("starting program")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
shell.run(whattodo)
else
term.clear()
term.setCursorPos(1, 1)
end
and this is my startupprogram.txt
it's not mutch, i know.
the file startupprogram.txt is in the lua\rom\apis map.
and it is really not about my program chestdispencer.
and when i print whattodo just before shell.run(whattodo), it prints chestdispencer.
does anyone have a clue?
i've got a startupprogram that should work, but i don't get it working.
the error is a nil value error (think evereybody know wat it is) but i don't have any clue's any more.
my startupprogram search to a file called startupprogram.txt,
if it finds it, it shows the programname and after a few seconds it runs it.
at least it should run it.
it says that he can't index a nil value.
but i don't see any value that doesn't exist.
this is my startupprogram.
Spoiler
term.clear()print("\n\n\n##################################################\n")
print("computercraft version; ", os.version())
print("Computer ID; ", os.computerID())
print("This computer is called; ", os.getComputerLabel())
lounchstartuppr=false
if fs.exists("startupprogram.txt") then
local file = fs.open("startupprogram.txt", "r")
whattodo = file.readAll()
file.close()
if whattodo ~= nil then
lounchstartuppr=true
print("opening on startup; ", whattodo)
else
print("file startupprogram.txt is not made proper")
end
else
print("opening on startup; -")
end
print("##################################################\n")
sleep(3)
print("going to execute")
if lounchstartuppr==true then
print("starting program")
sleep(1)
term.clear()
term.setCursorPos(1, 1)
shell.run(whattodo)
else
term.clear()
term.setCursorPos(1, 1)
end
and this is my startupprogram.txt
it's not mutch, i know.
Spoiler
chestdispencerthe file startupprogram.txt is in the lua\rom\apis map.
and it is really not about my program chestdispencer.
and when i print whattodo just before shell.run(whattodo), it prints chestdispencer.
does anyone have a clue?