This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
merithes's profile picture

problem (table: [hexadecimal) and more :(

Started by merithes, 29 May 2014 - 03:22 PM
merithes #1
Posted 29 May 2014 - 05:22 PM
I made this program but when I run it the computer answers "table:" and then an hexadecimal number that changes every time
and before I modified it I had another problem, the program always printed "error" and then rebooted, as it should do if in the first step the response wasn't a 1 or 2 (even if it was)





local yes = 1
local no =2
print("Do you want to install LabyOS ?")
print(
"1=yes",
"2=no"
}
local ans = read()
if ans == yes then
print("do you want a startup launch ?")
print{"1=yes",
  "2=no"
  }

elseif ans == no then
os.reboot()

else
print("error")
sleep(5)
os.reboot()
end


local ans = read()
if ans == yes then
shell.run("pastebin get eVph1zkH startup")
else
print(please write the program name:") --crying happy smiley lol
local ans = read
shell.run("pastebin get eVph1zkH"..ans)
end

0099 #2
Posted 29 May 2014 - 07:39 PM
Change {} to (). When you write print{…} Lua translates it to print({…}). {…} creates a table. print() tries to print this table. Because it isn't a text, it calls tostring({…}). It returns "table: …". It's like a reference to that table.

P.S. If you don't know wtf table is, just ignore all this. Just change {} to ().
merithes #3
Posted 30 May 2014 - 10:50 AM
thanks :)/>