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

[Lua][Error] bios:338: [string "branch"]:9: <name> or '...' expected

Started by Astro Nit, 28 December 2012 - 11:17 PM
Astro Nit #1
Posted 29 December 2012 - 12:17 AM
Good morning ladies/gents,

I've only just got into Computer Craft, and as such I have been taking other peoples code and trying to use that, then adapt it. Only problem is I can't get it to run in the first place. I have this code on my turtle and I believe it's purpose is to simply dig a straight tunnel and place torches every so often. I keep getting the error in the title though.

Help? Thanks in advance

EDIT: The more detailed the reply in what I'm doing wrong, the better please, I'd like to not have to come here for bug checking, no offence intended

http://pastebin.com/8esjgbnq
remiX #2
Posted 29 December 2012 - 01:03 AM
Your tfuel function has a '1' in the (). I'm guessing you want that as an argument for it to select that slot after refueling, if so:


function tfuel(nSlot)
 if turtle.getFuelLevel() < 5 then
  turtle select(16)
  turtle.refuel(1)
  turtle.select(nSlot)
 end
end

Or is it the amount it must refuel?



function tfuel(nAmount)
 if turtle.getFuelLevel() < 5 then
  turtle select(16)
  turtle.refuel(nAmount)
  turtle.select(1)
 end
end
AngelMalus #3
Posted 29 December 2012 - 02:34 AM
Or just remove the 1 from the parenthesis. It should work fine.
remiX #4
Posted 29 December 2012 - 03:33 AM
Or just remove the 1 from the parenthesis. It should work fine.

Depends how he wants his function to function :P/> I took it as he wants to select the slot with the arguments
Astro Nit #5
Posted 30 December 2012 - 01:59 AM
That fixed it, thanks a lot :D/>