Concepts/Vectors_and_colours
Vector(x, y, z) is used for every 3D position. On the server it is an object with float fields x, y, z. Vector2D(x, y) is the same with z fixed at 0.
Floats are doubles (v0.5.1). Squirrel float values are 64 bit on the server and in the client scripts (they were 32 bit), so large coordinates and money with cents keep their precision. Native modules keep working: lu_sqlite2 (then called lu_db), lu_ini and lu_http were rebuilt to use the new pushdouble / getdouble entries of the module API.
Colour(r, g, b [, a]) has float fields r, g, b, a (0-255). Default alpha is 128 on the server.
local pos = player.Pos;
CreateVehicle(VEH_TAXI, Vector(pos.x + 4.0, pos.y, pos.z), 0.0, 6, 6);
local red = Colour(255, 0, 0);
MessagePlayer("Warning!", player, red);NoteOn the client, entity positions are returned as plain tables
{x=, y=, z=} instead of Vector objects. Reading .x .y .z works the same.Categories: Core concepts