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

Printer program error [Expected number,number]

Started by Teraminer, 29 September 2012 - 12:07 PM
Teraminer #1
Posted 29 September 2012 - 02:07 PM
I get the above error when I run the program and when I use tonumber (probabily incorect) get expected ")" at line 8.

Thanks in andvance


PS: the pastebin URL/code http://pastebin.com/zr1A6a9N remove the tonumber to see the error.
MysticT #2
Posted 29 September 2012 - 08:36 PM
You didn't define x and t. You need to define them before using them.
Here's a modified version:

local tArgs = {...}
local printer = peripheral.wrap("left")
printer.newPage()
printer.setPageTitle(tArgs[1])
for y = 2, #tArgs do
  printer.setCursorPos(1,y - 1)
  printer.write(tArgs[y])
end
Teraminer #3
Posted 30 September 2012 - 11:09 AM
thanks btw #tAgrs means number of arguments?
MysticT #4
Posted 30 September 2012 - 03:27 PM
thanks btw #tAgrs means number of arguments?
Yes. # is the lenght operator in lua, it gets the lenght of strings or tables. tArgs is a table with the passed arguments, so it's lenght is the number of arguments.
Teraminer #5
Posted 30 September 2012 - 05:49 PM
Thanks Master "Sensei" Lua.