SlotPosition

The SlotPosition namespace is an extension of the c++ SlotPosition. Many of the functions in the api return or take a SlotPosition as an argument.

SlotPositions themselves are relatively complicated, and therefore require their own wrapper class. The SlotPositions in Squirrel follow the same rules and structure of the c++ version.

Example

local first = SlotPosition(1, 2);
local second = SlotPosition(3, 4, 50, 60, 70);

local third = first + second;
third.toVector3(); //Translate relative to the origin.

API

SlotPosition(chunkX, chunkY, posX, posY, posZ);()
Arguments:
  • chunkX (SQInteger()) – The chunkX.

  • chunkY (SQInteger()) – The chunkY.

  • posX (SQFloat()) – The position x.

  • posY (SQFloat()) – The position y.

  • posZ (SQFloat()) – The position z.

Returns:

A constructed SlotPosition.

Constructs a SlotPosition.

SlotPosition(chunkX, chunkY);()
Arguments:
  • chunkX (SQInteger()) – The chunkX.

  • chunkY (SQInteger()) – The chunkY.

Returns:

A constructed SlotPosition.

Constructs a SlotPosition, setting the position coordinates to their default of 0.

Operator+()
Returns:

A new SlotPosition containing the result of the addition operation on two other SlotPositions.

Constructs a new SlotPosition from the two used in the operation.

local third = first + second;
Operator-()
Returns:

A new SlotPosition containing the result of the subtraction operation on two other SlotPositions.

Constructs a new SlotPosition from the two used in the operation.

local third = first - second;
toVector3()
Returns:

An array containing the origin respecting vector.

This function does not modify the contents of the SlotPosition at all.