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

pcall acting weirdly

Started by MudkipTheEpic, 11 March 2013 - 09:16 AM
MudkipTheEpic #1
Posted 11 March 2013 - 10:16 AM
Somehow, pcall is acting weirdly. When I do pcall(print("test")), it prints test, but returns false and the error: attempt to call number. I am using this in the lua program.

Edit: Oh ya, pcall doesnt take arguments.
Lyqyd #2
Posted 11 March 2013 - 10:32 AM
You're using it wrong.

pcall(print, "test")
LBPHacker #3
Posted 11 March 2013 - 10:38 AM
Edit: Oh ya, pcall doesnt take arguments.
Yes it does!

print("test") returns the number of the lines printed (1, in this case). pcall cannot call 1, because it's a number, not a function.

Use Lyqyd's solution.