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

Y TIS NO BE WORK?! [Error] [Lua]

Started by SupaMiner, 08 October 2012 - 03:36 PM
SupaMiner #1
Posted 08 October 2012 - 05:36 PM

movementMethods = {
turtle.forward(),
turtle.back(),
turtle.up(),
turtle.down()
}
while true do
local number = math.random(4)
movementMethods[number]
end

Output:






Also, how do I copy and paste inside the computer?? It just closes…
Pinkishu #2
Posted 08 October 2012 - 05:39 PM
You want the functions, not call them so
turtle.up instead of turtle.up()
then call them once retrieving them:

movementMethods = {
turtle.forward,
turtle.back,
turtle.up,
turtle.down
}
while true do
local number = math.random(4)
movementMethods[number]()
end
SupaMiner #3
Posted 08 October 2012 - 05:41 PM
Ohh, thanks for the quick help!
SupaMiner #4
Posted 08 October 2012 - 05:48 PM
Also how do I copy and paste when editing?
PixelToast #5
Posted 08 October 2012 - 05:52 PM
you cant, you can edit the file directly by going to /saves/<level>/computer/<id>/<program>
personally i would recommend np++ because it has syntax highlighting
if your on a server than you will have to use http/pastebin, check the wiki