Jump to content




ImageIO Peripheral Setup Help


  • You cannot reply to this topic
3 replies to this topic

#1 coranos

  • Members
  • 36 posts

Posted 03 October 2012 - 02:38 AM

Hi,
I'm creating a new peripheral that reads an image from a URL and returns it as a list of rgb values, but I can't seem to get the peripheral method call working.

this returns "test"
public Object[] callMethod(IComputerAccess computer, int method,
Object[] arguments) throws Exception {

return new Object[] { "test" };
}
but this doesn't return an array, it only returns "4":
public Object[] callMethod(IComputerAccess computer, int method,
Object[] arguments) throws Exception {

return new Object[] { 4,3,2 };
}
Am I doing something wrong?
I also tried returning a LuaTable, but that returned 'nil' to the turtle.

#2 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 03 October 2012 - 03:41 AM

It returned 4 and 3 and 2. I'm guessing you only assigned it to one variable so the rest were discarded. Try this:
a, b, c = peripheral.call("side", "methodName")
or this:
myTable = {peripheral.call("side", "methodName")}


#3 coranos

  • Members
  • 36 posts

Posted 03 October 2012 - 04:14 AM

I did print(tostring(peripheral.call("side", "methodName")), will try the table approach :(/>

here's what I'm making btw (create statues from skin files).
https://www.youtube....h?v=53RkV8hc3yQ

The script currently works but needs 2 stages, since I can't call luajava from within computercraft anymore (thus the periperal) I need to create the turtles script outside of minecraft, then run the script inside of minecraft.

#4 Xfel

    Peripheral Designer

  • Members
  • 515 posts

Posted 03 October 2012 - 07:29 AM

try print without tostring.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users