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

The best way for coordinates?

Started by Tjakka5, 05 January 2013 - 06:14 AM
Tjakka5 #1
Posted 05 January 2013 - 07:14 AM
Hello,

I'm currently trying out what the best way to create coordinates is.
When I tried it myself I got something big, that mainly had if statements:

When I asked my father he replied "Arrays" but didnt explain it…
Help?

Thanks in advantage.
1lann #2
Posted 05 January 2013 - 07:21 AM
In Lua, that would be tables. So you could do something like this to create the coordinates

coordinates = {x = 1, y = 12, z = 13}

then to get the x coordinate of whatever, you can do

coordinates.x

and that applies to every axis.