Posted 25 September 2012 - 05:38 AM
Hi,
So I'm trying to make a computer program that reads in an image, and makes a statue out of woll based on that image. So far, I can get it working outside of computercraft but not inside computercraft.
Is this possible to do? Or will I have to write java code rather than LUA to do it?
The following LUA reads in an image and prints width and height when run in eclipse:
java_awt_image_BufferedImage = luajava.bindClass( "java.awt.image.BufferedImage" );
java_net_URL = luajava.bindClass( "java.net.URL" );
javax_imageio_ImageIO = luajava.bindClass( "javax.imageio.ImageIO" );
java_awt_Color = luajava.bindClass( "java.awt.Color" );
url = luajava.newInstance("java.net.URL", "http://www.minecraft.net/images/char.png" );
image = javax_imageio_ImageIO:read(url);
print("image = " .. image:getWidth() .. "," .. image:getHeight());
but when I run it on a computer, it says in line #1 "attempt to index a null value"
So I'm trying to make a computer program that reads in an image, and makes a statue out of woll based on that image. So far, I can get it working outside of computercraft but not inside computercraft.
Is this possible to do? Or will I have to write java code rather than LUA to do it?
The following LUA reads in an image and prints width and height when run in eclipse:
java_awt_image_BufferedImage = luajava.bindClass( "java.awt.image.BufferedImage" );
java_net_URL = luajava.bindClass( "java.net.URL" );
javax_imageio_ImageIO = luajava.bindClass( "javax.imageio.ImageIO" );
java_awt_Color = luajava.bindClass( "java.awt.Color" );
url = luajava.newInstance("java.net.URL", "http://www.minecraft.net/images/char.png" );
image = javax_imageio_ImageIO:read(url);
print("image = " .. image:getWidth() .. "," .. image:getHeight());
but when I run it on a computer, it says in line #1 "attempt to index a null value"