Documentation for my vector, colour, and mesh code

I suspect that most of the code that I write is too tied to my way of working to be easily usable by others. The bits that might be are my extension libraries. These take built-in objects in Codea and add extra functionality. Because they work with existing objects, they probably would be more readily integrated into others’ code than the rest of my stuff.

As much for my own benefit as for others, I’ve written up these extensions and posted it on my website at:

The code itself can be found on github:

Looks very interesting. Examples of usage would be helpful, I think. And I’m going to have to learn a lot about metatables to understand what you’ve done. Thanks!

P.S. A link to Utilities might be handy. I was looking for e.g. edge to see what its description meant and couldn’t find it.

Good stuff, thanks!


The utilities are part of the VecExt file, mostly defined at the start. edge, for example, starts on line 111.

@Loopspace - thanks for the link, your code and contributions have been invaluable. At much higher level than I can code but I managed to plod along. Thanks.

Quick question for you - I assume you are into Fibonacci series, but do you know how to use binary, hex in Codea. A very famous UK programmer used them to describe an 8 galaxy universe to fit into an 8bit computer with a massive 32K ram. Been looking at the approach but it’s kinda slow to sink in.

Hi @Bri_G. Actually, I’m not a huge fan of Fibonacci! But that’s just a personal preference.

Binary is now quite easy to do with lua 5.3, the binary operations are now implemented. For example, 6 & 4 is the AND operator, 6 | 4 is the OR operator. Hex is really just a convenient way of writing binary for humans to read, so there’s unlikely to be something you need to do with hex that can’t be done with binary.

If you need to print out numbers as binary or hex then there’s an old binary & hex library that I adapted to Codea (and added octal) which can be found in my github files if you’re interested. I suspect that much of it is now defunct but I imported it in the days before lua5.3 when it was needed.

@LoopSpace - thanks for that, will try out the Lua defs. first and scan your library again. The Fibonacci, we’re told, is used for random number generation. I need to build a flow chart so that I can follow/reproduce the output from the original code. Thanks again.