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

Nil Argument Error?

Started by Symmetryc, 16 December 2013 - 08:31 PM
Symmetryc #1
Posted 16 December 2013 - 09:31 PM
Alright so there is this really weird thing going on that I don't quite understand:

term.setBackgroundColor(colors.blue) --> No error, works normally
term.setBackgroundColor(colors.blue, nil) --> Number expected error
term.setBackgroundColor(colors.blue, 0) --> Still Number expected error

local termxsetBackgroundColor = function(_color, _extra)
return term.setBackgroundColor(_color, _extra)
end
termxsetBackgroundColor(colors.blue) --> Number expected error
Can anyone explain? Thanks!
Lyqyd #2
Posted 16 December 2013 - 09:55 PM
Java side probably just complains whenever the argument count is wrong or if the argument type is wrong.
theoriginalbit #3
Posted 16 December 2013 - 09:57 PM
I'm just going to put my theory out there that I stated in the PM.

I have a feeling it may be something Java-side (I will confirm later). The method signature may be public void setBackgroundColour(int colour, int someOtherInt) and when you supply 2 or more args they're passed to the method, instead of just the first being passed along with the other int that is added in on the Java-side

EDIT: Oh Lyqyd the ninja. haha.
Edited on 16 December 2013 - 08:57 PM
Symmetryc #4
Posted 16 December 2013 - 09:57 PM
Java side probably just complains whenever the argument count is wrong or if the argument type is wrong.
Yeah that's what BIT said. Do you think that this warrants a thread move to the Bug section? Or would it be out of their control due to their use of LuaJ? I don't know the specifics on that stuff :/.

Edit: Ninja'd by BIT :/

Edit 2: Lol Ninja chaining (How I ironic :P/>)
Edited on 16 December 2013 - 08:59 PM