193 posts
Posted 14 March 2012 - 04:39 AM
Well I was working on a program and I wanted to know if redstone.getSides( ) did anything.
Aside from returning the sides you can use.
Does the sides ever change?
Will it always print those 6 no matter what you do
Im not talking about editing what it outputs
So basically is that code just print()?
161 posts
Posted 14 March 2012 - 04:51 AM
I suspect it probably just returns a constant array. Since I doubt Minecraft will ever have a different set of sides on a block, I doubt the return value will ever change. However, using the function avoids typos and spelling mistakes typing out all six sides by hand every time.
715 posts
Posted 14 March 2012 - 09:35 AM
@libraryaddict:
It will not print the sides, it will return them.
I suspect you called that function from within the Lua interactive shell?
Because then the return values will automatically be printed.
But what it really does, is to return a table with the 6 sides as strings, like this: { "top", "bottom", "left", "right", "front", "back" }
You can then iterate through it or access sides via index.
The benefit here is that, like Hawk777 already mentioned, you don't have to define your own table with sides everytime you want to do something with said sides.
Also, it's good to have the order of sides be consistent across different programs.
193 posts
Posted 14 March 2012 - 10:10 AM
Thanks.
I derped when saying print xD
524 posts
Location
Cambridge, England
Posted 14 March 2012 - 11:00 AM
It's a safety feature in case notch ever ports minecraft to the fourth dimension and makes everything out of hypercubes :mellow:/>/>